Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('wcfm_product_manage_fields_pricing', function($fields) {
- if(isset($fields['regular_price'])) {
- unset($fields['regular_price']);
- }
- if(isset($fields['sale_price'])) {
- unset($fields['sale_price']);
- }
- return $fields;
- });
- add_filter('wcfm_product_fields_stock', function($fields, $product_id) {
- $wcfm_wpml_edit_disable_element = '';
- if ( $product_id && defined( 'ICL_SITEPRESS_VERSION' ) && ! ICL_PLUGIN_INACTIVE && class_exists( 'SitePress' ) ) {
- global $sitepress, $wpml_post_translations;
- $current_language = $sitepress->get_current_language();
- $source_language = $wpml_post_translations->get_source_lang_code( $product_id );
- if( $source_language && ( $source_language != $current_language ) ) {
- $wcfm_is_translated_product = true;
- $wcfm_wpml_edit_disable_element = 'wcfm_wpml_hide';
- }
- }
- $regular_price = '';
- $sale_price = '';
- if(!empty($product_id)) {
- $product = wc_get_product($product_id );
- if ( is_a( $product, 'WC_Product' ) ) {
- $regular_price = $product->get_regular_price( 'edit' );
- $sale_price = $product->get_sale_price( 'edit' );
- }
- }
- if(!isset($fields['regular_price'])) {
- $fields['regular_price'] = array('label' => __('Price', 'wc-frontend-manager') . ' (' . get_woocommerce_currency_symbol() . ')', 'type' => 'number', 'class' => 'wcfm-text wcfm_ele wcfm_non_negative_input simple external non-subscription non-variable-subscription non-auction non-redq_rental non-accommodation-booking non-lottery non-pw-gift-card' . ' ' . $wcfm_wpml_edit_disable_element, 'label_class' => 'wcfm_ele wcfm_title simple external non-subscription non-variable-subscription non-auction non-redq_rental non-accommodation-booking non-lottery non-pw-gift-card' . ' ' . $wcfm_wpml_edit_disable_element, 'value' => $regular_price, 'attributes' => array( 'min' => '0.1', 'step'=> '0.1' ) );
- }
- if(!isset($fields['sale_price'])) {
- $fields['sale_price'] = array('label' => __('Sale Price', 'wc-frontend-manager') . ' (' . get_woocommerce_currency_symbol() . ')', 'type' => 'number', 'class' => 'wcfm-text wcfm_ele wcfm_non_negative_input simple external non-variable-subscription non-auction non-redq_rental non-accommodation-booking non-lottery non-pw-gift-card' . ' ' . $wcfm_wpml_edit_disable_element, 'label_class' => 'wcfm_ele wcfm_title simple external non-variable-subscription non-auction non-redq_rental non-accommodation-booking non-lottery non-pw-gift-card' . ' ' . $wcfm_wpml_edit_disable_element, 'value' => $sale_price, 'desc_class' => 'wcfm_ele simple external non-variable-subscription non-auction non-redq_rental non-accommodation-booking non-lottery non-pw-gift-card sales_schedule' . ' ' . $wcfm_wpml_edit_disable_element, 'desc' => __( 'schedule', 'wc-frontend-manager' ), 'attributes' => array( 'min' => '0.1', 'step'=> '0.1' ) );
- }
- return $fields;
- }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement