Woocommerce定制产品变量

时间:2017-10-03 21:13:49

标签: php wordpress variables woocommerce

所以我对Wordpress和Woocommerce产品有一个问题,在循环中的单个产品页面上我创建了这样的自定义变量:

// Quantity
$quantity = get_post_meta( $post->ID, "wccaf_quantity", true ); 
// Regular Price
$regular_price = get_post_meta( get_the_ID(), '_regular_price', true);
// Subtotal
$subtotal = $quantity * $regular_price;

计算基于用户通过Wordpress管理面板输入的自定义字段。这一切都在前端工作,但我遇到了一个问题,我想在产品页面上对产品进行排序,例如。 $ subtotal变量。我是否有可能以某种方式实现这一点,将此变量称为post meta或者其他东西。我对PHP很好,但不知道它在Wordpress中是如何工作的

您可以在此处查看该网站,投资详情中的说明标签: http://aldinmujkic.website/yehuda1/product/amazonbasics-apple-certified-lightning-to-usb-cable/

1 个答案:

答案 0 :(得分:0)

是的,您可以使用post meta查询帖子。以下示例

Intent inntent = new Intent(this,LoginActivity.class);
startActivity(inntent);