@@ -96,7 +96,7 @@ private function __construct() {
96
96
*/
97
97
add_action ('wp_ajax_new_offer_form_submit ' , array ($ this , 'new_offer_form_submit ' ));
98
98
add_action ('wp_ajax_nopriv_new_offer_form_submit ' , array ($ this , 'new_offer_form_submit ' ));
99
-
99
+
100
100
/* Add "Make Offer" button code parts - Before add to cart */
101
101
add_action ('woocommerce_before_add_to_cart_button ' , array ($ this , 'angelleye_ofwc_before_add_to_cart_button ' ));
102
102
add_action ('woocommerce_after_add_to_cart_form ' , array ($ this , 'angelleye_ofwc_after_add_to_cart_form ' ));
@@ -3400,10 +3400,13 @@ public function ofwc_get_product_detail($offer_id, $product_id, $variant_id) {
3400
3400
3401
3401
$ product_price = (isset ($ actual_sales_price ) && !empty ($ actual_sales_price )) ? $ actual_sales_price : $ actual_regular_price ;
3402
3402
$ productData ['offer_price ' ] = $ offer_price = get_post_meta ($ offer_id , 'offer_price_per ' , true );
3403
- $ productData ['user_offer_percentage ' ] = $ user_offer_percentage = $ this ->ofwc_get_percentage ($ offer_price , $ product_price );
3403
+ $ productData ['user_offer_percentage ' ] = 0 ;
3404
+ if ($ product_price > 0 ) {
3405
+ $ productData ['user_offer_percentage ' ] = $ this ->ofwc_get_percentage ($ offer_price , $ product_price );
3406
+ }
3404
3407
$ product = ( $ variant_id ) ? wc_get_product ($ variant_id ) : wc_get_product ($ product_id );
3405
- $ productData ['product_url ' ] = $ product_url = $ product ->get_permalink ();
3406
- $ productData ['offer_uid ' ] = $ offer_uid = get_post_meta ($ offer_id , 'offer_uid ' , true );
3408
+ $ productData ['product_url ' ] = $ product ->get_permalink ();
3409
+ $ productData ['offer_uid ' ] = get_post_meta ($ offer_id , 'offer_uid ' , true );
3407
3410
3408
3411
return $ productData ;
3409
3412
}
0 commit comments