×

How to multiply the price in "bookings"

Home WPAli Support Forums WooCommerce Order Builder How to multiply the price in "bookings"

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #887
    Ichitux
    Participant

    Hello,

    I’ve been working on a site using WooCommerce and the plugin Order Builder to make some bookings. It’s really nice and it do the trick for most of my products, but i want to make a new one, and i don’t know how to do it.

    I need to make a product that i can choose the number of days and multiply it by the number of people.

    Is it possible to do with Order Builder or WooCommerce? I would be so gratefull for your help.

    Kind regards.

    #888
    Ali Khallad
    Keymaster

    Hello, the plugin works as a product builder, it doesn’t not add any booking functionality to the site.

    #889
    Ichitux
    Participant

    Hello,

    Thanks for your reply, i’m trying to do this by myself.
    Is there any way to identify the “product ids” for this variations? I mean, If i create a WooCommerce product variation it has its own IDs for Product and for Variations.
    Then, can i get the Product building ids somehow?

    Then with this IDs i can do some function filter/hook to reproduce my ideas.

    I look forward to hear from you

    Kind regards.

    #890
    Ali Khallad
    Keymaster

    Can you explain what you are trying to do in more details, it’s not really clear.

    #891
    Ali Khallad
    Keymaster

    Note that items does have IDs, but you’ll need to dig in the code on your own to figure out how everything works if you’re looking to customize something.

    There is no quick way of explaining, and also it depends on the context, so you need to provide first your attempt, and some sample code if you want us to help correct your attempt, we can not write custom code for you.

    #894
    Ichitux
    Participant

    Hello,

    My idea is more or less this one:

    function price_discount_by_id( $price ){
    $my_product_id = YYY;
    $product = wc_get_product( $my_product_id );

    if ( $product === $my_product_id ) {
    return $price*0.15;
    }
    return $price
    }
    add_filter( ‘woocommerce_product_get_price’, ‘price_discount_by_id’, 10, 2 );

    I don’t know if it really works but i need to know the “YYY” ID to set manually a discount price only for one variation ID or what i ment one product built by your plugin had a 15% discount.

    Kind regards.

    #895
    Ali Khallad
    Keymaster

    I’m not sure what you really mean by one variation ID, do you mean the product added to cart, or single product items?
    Our plugin does not change anything in WooCommerce structure, it just add options, so you’d do as you would for any simple product, your approach above is not going to work.

    Look at this answer on stackoverflow: https://stackoverflow.com/questions/42135852/adding-a-discount-by-cart-items-conditionally-based-on-the-item-quantity

    Otherwise, if you are looking to customize our plugin we’ll not be able to help as this is considered custom work and not part of support.

    Regards

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.