Changeset 3184360
- Timestamp:
- 11/08/2024 11:14:46 AM (17 months ago)
- Location:
- hertwill
- Files:
-
- 6 edited
- 1 copied
-
tags/1.1.0 (copied) (copied from hertwill/trunk)
-
tags/1.1.0/hertwill.php (modified) (1 diff)
-
tags/1.1.0/options.php (modified) (1 diff)
-
tags/1.1.0/readme.txt (modified) (2 diffs)
-
trunk/hertwill.php (modified) (1 diff)
-
trunk/options.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hertwill/tags/1.1.0/hertwill.php
r3170745 r3184360 4 4 * Plugin URI: https://hertwill.com/ 5 5 * Description: Hertwill companion plugin for managing your products 6 * Version: 1. 0.66 * Version: 1.1.0 7 7 * Author: Hertwill 8 8 * Author URI: https://hertwill.com -
hertwill/tags/1.1.0/options.php
r3036277 r3184360 64 64 global $post; 65 65 66 // Check if 'hw' metadata exists for the product 67 $hw_metadata = get_post_meta($post->ID, '_hw_product_cost', true); 66 $product = wc_get_product($post->ID); 68 67 69 // Check if 'cost_price' field exists within 'hw' metadata 70 $cost_price_value = isset($hw_metadata) ? $hw_metadata : ''; 68 // Handle simple product 69 if ($product->is_type('simple')) { 70 $cost_price_value = get_post_meta($post->ID, '_hw_product_cost', true); 71 71 72 // Display cost price field only if 'cost_price' exists in 'hw' metadata73 if (!empty($cost_price_value)) {74 woocommerce_wp_text_input(array(75 'id' => 'hw_cost_price',76 'class' => 'short wc_input_price',77 'label' => 'Cost (€)',78 'data_type' => 'price',79 'value' => $cost_price_value,80 'custom_attributes' => array(81 'readonly' => 'readonly',82 ) ,83 ));72 if (!empty($cost_price_value)) { 73 woocommerce_wp_text_input(array( 74 'id' => 'hw_cost_price', 75 'class' => 'short wc_input_price', 76 'label' => 'Cost (€)', 77 'data_type' => 'price', 78 'value' => $cost_price_value, 79 'custom_attributes' => array( 80 'readonly' => 'readonly', 81 ), 82 )); 83 } 84 84 } 85 86 // Handle variable product 87 if ($product->is_type('variable')) { 88 89 $variations = $product->get_children(); 90 foreach ($variations as $variation_id) { 91 $variation_product = wc_get_product($variation_id); 92 93 $variation_cost_price = get_post_meta($variation_id, '_hw_product_cost', true); 94 $variation_cost_price = !empty($variation_cost_price) ? $variation_cost_price : ''; 95 96 $variation_sku = $variation_product->get_sku(); 97 98 if (!empty($variation_cost_price)) { 99 woocommerce_wp_text_input(array( 100 'id' => 'hw_cost_price_' . $variation_id, 101 'class' => 'short wc_input_price', 102 'label' => 'Cost (€) for SKU ' . $variation_sku, 103 'data_type' => 'price', 104 'value' => $variation_cost_price, 105 'custom_attributes' => array( 106 'readonly' => 'readonly', 107 ), 108 )); 109 } 110 } 111 } 112 85 113 } 86 114 -
hertwill/tags/1.1.0/readme.txt
r3170745 r3184360 4 4 Tags: ecommerce, woocommerce, dropshipping, fulfillment 5 5 Requires at least: 6.3 6 Tested up to: 6. 66 Tested up to: 6.7 7 7 Requires PHP: 7.4 8 Stable tag: 1. 0.68 Stable tag: 1.1.0 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 71 71 72 72 - Initial release 73 74 = 1.1.0 = 75 76 - Display product cost for variable products -
hertwill/trunk/hertwill.php
r3170745 r3184360 4 4 * Plugin URI: https://hertwill.com/ 5 5 * Description: Hertwill companion plugin for managing your products 6 * Version: 1. 0.66 * Version: 1.1.0 7 7 * Author: Hertwill 8 8 * Author URI: https://hertwill.com -
hertwill/trunk/options.php
r3036277 r3184360 64 64 global $post; 65 65 66 // Check if 'hw' metadata exists for the product 67 $hw_metadata = get_post_meta($post->ID, '_hw_product_cost', true); 66 $product = wc_get_product($post->ID); 68 67 69 // Check if 'cost_price' field exists within 'hw' metadata 70 $cost_price_value = isset($hw_metadata) ? $hw_metadata : ''; 68 // Handle simple product 69 if ($product->is_type('simple')) { 70 $cost_price_value = get_post_meta($post->ID, '_hw_product_cost', true); 71 71 72 // Display cost price field only if 'cost_price' exists in 'hw' metadata73 if (!empty($cost_price_value)) {74 woocommerce_wp_text_input(array(75 'id' => 'hw_cost_price',76 'class' => 'short wc_input_price',77 'label' => 'Cost (€)',78 'data_type' => 'price',79 'value' => $cost_price_value,80 'custom_attributes' => array(81 'readonly' => 'readonly',82 ) ,83 ));72 if (!empty($cost_price_value)) { 73 woocommerce_wp_text_input(array( 74 'id' => 'hw_cost_price', 75 'class' => 'short wc_input_price', 76 'label' => 'Cost (€)', 77 'data_type' => 'price', 78 'value' => $cost_price_value, 79 'custom_attributes' => array( 80 'readonly' => 'readonly', 81 ), 82 )); 83 } 84 84 } 85 86 // Handle variable product 87 if ($product->is_type('variable')) { 88 89 $variations = $product->get_children(); 90 foreach ($variations as $variation_id) { 91 $variation_product = wc_get_product($variation_id); 92 93 $variation_cost_price = get_post_meta($variation_id, '_hw_product_cost', true); 94 $variation_cost_price = !empty($variation_cost_price) ? $variation_cost_price : ''; 95 96 $variation_sku = $variation_product->get_sku(); 97 98 if (!empty($variation_cost_price)) { 99 woocommerce_wp_text_input(array( 100 'id' => 'hw_cost_price_' . $variation_id, 101 'class' => 'short wc_input_price', 102 'label' => 'Cost (€) for SKU ' . $variation_sku, 103 'data_type' => 'price', 104 'value' => $variation_cost_price, 105 'custom_attributes' => array( 106 'readonly' => 'readonly', 107 ), 108 )); 109 } 110 } 111 } 112 85 113 } 86 114 -
hertwill/trunk/readme.txt
r3170745 r3184360 4 4 Tags: ecommerce, woocommerce, dropshipping, fulfillment 5 5 Requires at least: 6.3 6 Tested up to: 6. 66 Tested up to: 6.7 7 7 Requires PHP: 7.4 8 Stable tag: 1. 0.68 Stable tag: 1.1.0 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 71 71 72 72 - Initial release 73 74 = 1.1.0 = 75 76 - Display product cost for variable products
Note: See TracChangeset
for help on using the changeset viewer.