How to multiply the price in "bookings"
Home › WPAli Support Forums › WooCommerce Order Builder › How to multiply the price in "bookings"
- This topic has 6 replies, 2 voices, and was last updated 5 years, 3 months ago by Ali Khallad.
-
AuthorPosts
-
August 21, 2019 at 8:24 am #887IchituxParticipant
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.
August 21, 2019 at 11:44 am #888Ali KhalladKeymasterHello, the plugin works as a product builder, it doesn’t not add any booking functionality to the site.
August 21, 2019 at 12:33 pm #889IchituxParticipantHello,
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.
August 21, 2019 at 12:49 pm #890Ali KhalladKeymasterCan you explain what you are trying to do in more details, it’s not really clear.
August 21, 2019 at 12:50 pm #891Ali KhalladKeymasterNote 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.
August 22, 2019 at 7:16 am #894IchituxParticipantHello,
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.
August 22, 2019 at 11:37 am #895Ali KhalladKeymasterI’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
-
AuthorPosts
- You must be logged in to reply to this topic.