default.php
47 lines
| 1 | <?php defined('ABSPATH') || exit; |
| 2 | |
| 3 | $post_type = get_post_type(); |
| 4 | |
| 5 | $product = \ShopEngine\Widgets\Products::instance()->get_product($post_type); |
| 6 | |
| 7 | if(!$product->get_sku()) { |
| 8 | |
| 9 | if($post_type == \ShopEngine\Core\Template_Cpt::TYPE) { |
| 10 | echo esc_html__('This product has no sku', 'shopengine'); |
| 11 | } |
| 12 | |
| 13 | return; |
| 14 | } |
| 15 | |
| 16 | ?> |
| 17 | |
| 18 | <div class="shopengine-sku"> |
| 19 | |
| 20 | <?php do_action('woocommerce_product_meta_start'); ?> |
| 21 | |
| 22 | <?php if(wc_product_sku_enabled() && ($product->get_sku() || $product->is_type('variable'))) : ?> |
| 23 | |
| 24 | <span class="sku-wrapper"> |
| 25 | |
| 26 | <?php if(isset($settings['shopengine_product_sku_label_show']) && $settings['shopengine_product_sku_label_show'] == 'yes') : ?> |
| 27 | |
| 28 | <span class="sku-label"><?php esc_html_e('SKU:', 'shopengine'); ?></span> |
| 29 | |
| 30 | <?php endif; ?> |
| 31 | |
| 32 | <span class="sku-value"> |
| 33 | <?php |
| 34 | if(empty( $product->get_sku())) { |
| 35 | echo esc_html__('N/A', 'shopengine'); |
| 36 | } else { |
| 37 | echo esc_html($product->get_sku()); |
| 38 | } |
| 39 | ?> |
| 40 | </span> |
| 41 | |
| 42 | </span> |
| 43 | |
| 44 | <?php endif; ?> |
| 45 | |
| 46 | </div> |
| 47 |