将变量产品添加到全局allow backorder命令

时间:2018-10-12 03:29:12

标签: php wordpress woocommerce custom-taxonomy stock

是否可以将变量产品添加到backorder命令中?我以前曾使用过此Allow backorders and notify customer for parent product categories in Woocommerce,并且工作正常,但是代码似乎无法在可变产品中使用。请帮助谢谢

1 个答案:

答案 0 :(得分:1)

要处理产品变体,请尝试以下操作:

import requests
from bs4 import BeautifulSoup

url = "https://www.weather-forecast.com/locations/Bangalore/forecasts/latest"

data = requests.get(url)
soup = BeautifulSoup(data.text, "lxml")

soup.find("span", {"class": "phrase"}).text
#'Light rain (total 2mm), mostly falling on Sun night. Warm (max 30°C on Sat afternoon, min 20°C on Sat night). Wind will be generally light.'

代码进入您的活动子主题(或活动主题)的function.php文件中。

相关:Allow backorders and notify customer for specific product categories in Woocommerce