• I’m trying to integrate your discount price, only for discounts that are not affected by cart rules, like site-wide or category-wide discounts, but when using $product->get_current_price() I get the base product price and not the one generated by your discount.

    After checking your code I’m now using this:

    if ( $prices = \Wdr\App\Controllers\ManageDiscount::calculateInitialAndDiscountedPrice( $product, 1 ) ) {
    	if ( isset( $prices['discounted_price_with_tax'] ) && floatval( $prices['discounted_price_with_tax'] ) > 0 ) {
    		$price = floatval( $prices['discounted_price_with_tax'] );
    	}
    }
    return $price;

    Is it OK to use this method, or do you recommend another safer and future-proof approach?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi

    Thank you for reaching out.

    In order to check for the applied discounts on the product through our plugin, can you please have a check with the below code:

    https://gist.github.com/AshlinRejo/c37a155a42c0e30beafbbad183f0c4e8

    Kindly have a check if that helps!

    For further queries, please raise a support request here:
    https://www.flycart.org/support

    Thanks,
    Team Flycart

    Thread Starter Marco Almeida | Webdados

    (@webdados)

    Something like this, then?

    if ( $discount = apply_filters( 'advanced_woo_discount_rules_get_product_discount_price_from_custom_price', $product->get_price(), $product, 1, 0, 'discounted_price', true, false ) ) {
      //We got discount
    }

    Hi

    This is Kowsaliya from Flycart.

    To get the discount price from our plugin, you can use this snippet
    https://gist.github.com/AshlinRejo/c37a155a42c0e30beafbbad183f0c4e8

    The above snippet helps you to get a discount on a specific product.
    While creating a feed you might have to add this event to get the discount value.
    If there is no discount it will return false.

    Example:
    $sale_price = $product->get_sale_price();//sale price or final price
    $discount = apply_filters(‘advanced_woo_discount_rules_get_product_discount_price_from_custom_price’, 10, $product, 1, $sale_price, ‘discounted_price’, true, true);
    if($discount !== false){
    //$discount -> Here we get discount amount
    $sale_price = $discount;
    }

    Hope this helps!

    Thanks
    Team Flycart

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Getting the discounted price for 3rd party integration’ is closed to new replies.