标签:product
-
如何在Woocommerce中检查产品是否具有特定的产品属性 - php
我想确定产品是否具有属性。例如: if (product has attribute 'pa_color') { //do something } 我该怎么做? 参考方案 您可以通过以下方式简单地使用WC_Product方法get_attribute(): // (If needed) Get an instance of the WC_ […]
-
从WooCommerce获取产品描述? - php
我为woocommerce构建了一个自定义的支付网关扩展,然后将所有数据(项目名称,成本,数量等)以JSON格式发布回支付提供商。 但是,我似乎无法理解项目说明。 有任何想法吗? 参考方案 当获取WP_post对象的实例时,可以在购物车对象项中使用以下方法: foreach(WC()->cart->get_cart() as $cart_item […]
-
在Woocommerce单一产品页面中获取产品类别名称和描述 - php
我一直在使用WooCommerce Codex,但似乎无法显示数据。我只想显示产品类别和说明,以便在自己的自定义布局中显示在单个产品页面上,如下所示。 <?php global $product; echo $product->get_attributes; ?> <?php global $product; echo $produc […]