• Resolved rajeshsingh520

    (@rajeshsingh520)


    Hi,

    We are adding cretain product in the cart as free product based on certail condition

    we are using set_price(0) for that all workes but as soon as person login the 0 price get replace with the B2B price of the product

    do you have any way to disable adding of B2B price on certial product in the cart

Viewing 4 replies - 1 through 4 (of 4 total)
    • This reply was modified 2 years, 11 months ago by twolightsaway.
    Plugin Author WebWizards

    (@webwizardsdev)

    Hi Rajesh,

    I could use some more details to understand this.

    Are you saying that you need to have B2B price for the product, but also want to set the price to 0 if certain conditions are met? But the issue is that B2BKing forces the B2B price, and your code to set the price to 0 is not working?

    Did I understand that correctly?

    I can give you a list of what hooks our plugin uses if that helps (so you can use those hooks to return the 0 price), but it would involve some work in setting that up.

    I wonder if it would be easier to simply use B2BKing’s Dynamic Rules for discounts to give a 100% discount

    Kind regards,
    Stefan

    Thread Starter rajeshsingh520

    (@rajeshsingh520)

    you are understood the issue correctly, send us the list of the hooks that will be great

    Plugin Author WebWizards

    (@webwizardsdev)

    This is the relevant code and the hooks our plugin applies:
    This code is found in class-b2bking-public.php

    add_filter('woocommerce_product_get_price', array($this, 'b2bking_individual_pricing_fixed_price'), 999, 2 );
    add_filter('woocommerce_product_get_regular_price', array($this, 'b2bking_individual_pricing_fixed_price'), 999, 2 );
    // Variations 
    add_filter('woocommerce_product_variation_get_regular_price', array($this, 'b2bking_individual_pricing_fixed_price'), 999, 2 );
    add_filter('woocommerce_product_variation_get_price', array($this, 'b2bking_individual_pricing_fixed_price'), 999, 2 );
    add_filter( 'woocommerce_variation_prices_price', array($this, 'b2bking_individual_pricing_fixed_price'), 999, 2 );
    add_filter( 'woocommerce_variation_prices_regular_price', array($this, 'b2bking_individual_pricing_fixed_price'), 999, 2 );
    // Set sale price as well
    add_filter( 'woocommerce_product_get_sale_price', array($this, 'b2bking_individual_pricing_discount_sale_price'), 999, 2 );
    add_filter( 'woocommerce_product_variation_get_sale_price', array($this, 'b2bking_individual_pricing_discount_sale_price'), 999, 2 );
    add_filter( 'woocommerce_variation_prices_price', array($this, 'b2bking_individual_pricing_discount_sale_price'), 999, 2 );
    add_filter( 'woocommerce_variation_prices_sale_price', array($this, 'b2bking_individual_pricing_discount_sale_price'), 999, 2 );
    // display html
    // Displayed formatted regular price + sale price
    add_filter( 'woocommerce_get_price_html', array($this, 'b2bking_individual_pricing_discount_display_dynamic_price'), 999, 2 );
    // Set sale price in Cart
    add_action( 'woocommerce_before_calculate_totals', array($this, 'b2bking_individual_pricing_discount_display_dynamic_price_in_cart'), 999, 1 );
    // Function to make this work for MiniCart as well
    add_filter('woocommerce_cart_item_price',array($this, 'b2bking_individual_pricing_discount_display_dynamic_price_in_cart_item'),999,3);
    • This reply was modified 2 years, 11 months ago by WebWizards. Reason: formatting
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Product added as free by set_price is getting replaced with B2B price’ is closed to new replies.