xah icon

product add-on plugin

xah | PRO | 09/30/20 10:18:57 PM UTC (Edited) | 0 ⭐ | 418 👁️ | Never ⏰ | []
PHP |

1.47 KB

|

None

|

0 👍

/

0 👎

// in includes/classes/class-fields.php
 
        public static function get_pricing_options() {
 
            $options = array(
                'fixed'     => array( 'label' => __('Flat fee (not quantity-based)', 'sw-wapf'), 'pro' => false ),
                'qt'        => array( 'label' => __('Quantity based flat fee', 'sw-wapf'), 'pro' => false ),
                'fx'     => array( 'label' => __('Formula (Pro only)', 'sw-wapf'), 'pro' => true )
 
// advanced-product-fields-for-woocommerce/includes/controllers/class-product-controller.php
 
        private function to_cart_fields(Field $field, $clone_idx = 0, $quantity = 1, $product) {
 
            $raw_value = Fields::get_raw_field_value_from_request($field, $clone_idx);
 
            $price_addition = array(); 
 
            if( $field->pricing_enabled() ) {
                $price_addition = Fields::pricing_value($field, $raw_value);
            }
 
            return array(
                'id'                => $field->id,
                'value'             => Fields::value_to_string($field, $raw_value, $price_addition > 0, $product),
                'value_cart'        => Fields::value_to_string($field, $raw_value, $price_addition > 0, $product,'cart'),
                'price'             => $price_addition,
                'qty'               => $quantity,
                'qty_based'         => false, // change from true
                'label'             => esc_html($field->label)
            );

Comments