2017-04-16 50 views
2

我無法在WooCommerce文檔中找到正確的SKU包裝引用鉤模板。WooCommerce引用sku包裝的鉤模板

我想要做的就是在產品彙總天空包裝/ SPAN切換到產品彙總後,像這樣:

remove_action('woocommerce_single_product_summary', 'woocommerce_SKUwrapper???', 10); 
add_action('woocommerce_after_single_product_summary', 'woocommerce_SKUwrapper???', 60); 

對這個有什麼想法? 我是否正確地做這件事,只需要sku包裝器參考?

感謝

回答

2

有一個在WooCommerce單品頁沒有包裝SKU鉤(或專用模板)...

的代碼輸出SKU位於single-product/meta.php.php模板:

<?php if (wc_product_sku_enabled() && ($product->get_sku() || $product->is_type('variable'))) : ?> 

    <span class="sku_wrapper"><?php esc_html_e('SKU:', 'woocommerce'); ?> <span class="sku"><?php echo ($sku = $product->get_sku()) ? $sku : esc_html__('N/A', 'woocommerce'); ?></span></span> 

<?php endif; ?> 

要「產品後彙總」改變位置,你將不得不刪除此代碼,並將其放置在內容單product.php後do_action('woocommerce_after_single_product_summary');

官方文檔:Template Structure + Overriding Templates via a Theme