Advertisement
xah

product add-on plugin

xah
Jun 18th, 2020 (edited)
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.47 KB | None | 0 0
  1. // in includes/classes/class-fields.php
  2.  
  3.         public static function get_pricing_options() {
  4.  
  5.             $options = array(
  6.                 'fixed'     => array( 'label' => __('Flat fee (not quantity-based)', 'sw-wapf'), 'pro' => false ),
  7.                 'qt'        => array( 'label' => __('Quantity based flat fee', 'sw-wapf'), 'pro' => false ),
  8.                 'fx'     => array( 'label' => __('Formula (Pro only)', 'sw-wapf'), 'pro' => true )
  9.  
  10. // advanced-product-fields-for-woocommerce/includes/controllers/class-product-controller.php
  11.  
  12.         private function to_cart_fields(Field $field, $clone_idx = 0, $quantity = 1, $product) {
  13.  
  14.             $raw_value = Fields::get_raw_field_value_from_request($field, $clone_idx);
  15.  
  16.             $price_addition = array();
  17.  
  18.             if( $field->pricing_enabled() ) {
  19.                 $price_addition = Fields::pricing_value($field, $raw_value);
  20.             }
  21.  
  22.             return array(
  23.                 'id'                => $field->id,
  24.                 'value'             => Fields::value_to_string($field, $raw_value, $price_addition > 0, $product),
  25.                 'value_cart'        => Fields::value_to_string($field, $raw_value, $price_addition > 0, $product,'cart'),
  26.                 'price'             => $price_addition,
  27.                 'qty'               => $quantity,
  28.                 'qty_based'         => false, // change from true
  29.                 'label'             => esc_html($field->label)
  30.             );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement