我想,包括我的代碼wc-formatting-functions.php
文件時,我改變內部WooCommerce插件文件夾的核心文件,它的工作。WooCommerce - 通過主題重寫WC-格式-functions.php文件不工作
現在我已經創建woocommerce
文件夾我的主題文件夾內,複製裏面wc-formatting-functions.php
文件,試圖超越,但它不工作。
我想裏面插入wc_price()
功能驗證碼:
if(is_product_category('mattress')){
echo "mattress category";
}
else if(is_product_category('pillows')){
echo "pillows category";
}
else if(is_product_category('protectors')){
echo "protectors category";
}
else if(is_product_category('toppers')){
echo "toppers category";
}
else if(is_product_category('foldable-mattress')){
echo "foldable-mattress category";
}
只是這些線路在WC-格式化-的functions.php後:
$formatted_price = ($negative ? '-' : '') . sprintf($price_format, '<span class="woocommerce-Price-currencySymbol">' . get_woocommerce_currency_symbol($currency) . '</span>', $price);
$return = '<span class="woocommerce-Price-amount amount">' . $formatted_price . '</span>';
我做錯了嗎?
TheAztec非常感謝你對漂亮explanation..now我想創建掛鉤,所以我可以根據圖像顯示category.i我試圖使用has_term('牀墊','product_cat'),但它沒有顯示任何分類頁面.. –
謝謝@Loic阿茲特克工作正常 –
阿茲特克可以請你看看這個問題,我有這個問題。請.http://stackoverflow.com/questions/38567523/woocommerce-price-overriding-in-cart-dynamically –