WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[resolved] Price based on width and height entered by customer (52 posts)

  1. Deaner666
    Member
    Posted 1 year ago #

    Hello there. I have a problem that I thought would be solved by the measurement price calculator extension, but that extension doesn't do what I expected at all! (I wonder if I'm the only person to think that?)

    I'm creating a site that sells banners and other printed products at custom sizes. The customer needs to be able to enter a width and a height and have a price generated that is an area calculation based on that width and height.

    The measurement price calculator ties this calculation into the quantity for some reason (ie. it works out how many of a product to order based on the given dimensions), I can't image many people wanting to use it like that, but I might be wrong.

    I need a customer to choose, say, a 2m x 1m banner, have a price displayed that's calculated from a per square metre price, and then be able to update the quantity to decide how many of those 2m x 1m banners they want.

    Can I do this in any of the following ways:

    * With the measurement price calculator extension
    * With a "width" and "height" attribute
    * In some other way I haven't thought of?

    Cheers,

    Dave

    http://wordpress.org/extend/plugins/woocommerce/

  2. Deaner666
    Member
    Posted 1 year ago #

    Bump...

    I'm desperately in need of this! Anybody got any ideas?

  3. ogdesign
    Member
    Posted 1 year ago #

    Hi Deaner666! I see it's been 2 month since your post, and you probably solved your problem already. But just in case, the Measurement Price Calculator can be set up for what you need. You just have to tick "Pricing" option in the Measurement tab. Feel in Pricing Lable if you need and the Pricing unit and you good to go. Good luck!

  4. Deaner666
    Member
    Posted 1 year ago #

    Hi ogdesign,

    Thanks for the reply. I think perhaps the measurement price calculator has been updated since I last tried it. I've just checked out the new demos from the woothemes extension page and it does seem to do more things than it used to.

    I managed to solve my particular situation using gravity forms and the gravity forms product add on extensions. I was able to use calculation fields to work out areas and prices. Gravity forms has the added bonus of allowing you to add other fields, like file upload fields which I needed for customers to upload their artwork. You can also use conditional logic in the forms to only show certain fields when they're required.

    Cheers,

    Dave

  5. jescarcha
    Member
    Posted 1 year ago #

    Hi deaner666,

    I am having the same need that you had with a price generated from the user inputed area. I too am using gravity forms and the gravity forms product add on extensions. I am currently stuck with multiplying the area by the product total. How were you able to work that out?

    Thanks,

    Jaffy

  6. Deaner666
    Member
    Posted 1 year ago #

    Hi jescarcha,

    You can see an example page showing what I've done here:

    http://www.print-2-media.com/shop/banners/pvc-banner-510gsm-single-sided/

    If you need more of an explanation of how it works then let me know.

    Cheers,

    Dave

  7. jescarcha
    Member
    Posted 1 year ago #

    Hey Deaner666,

    Your site has the same functionality that I need!

    Two things:

    I see that you have the product options changing the subtotal. Is there a setting that I missed?

    How were you able to have the height and width change the subtotal and total?

    The latter is something that I have been struggling with for quite a while. Did you have to dig through and change code? You help is very much appreciated!

    Thanks,

    Jaffy

  8. Deaner666
    Member
    Posted 1 year ago #

    It took me a while, but I managed to do it all using in-built Gravity Forms functionality. Calculation fields are the key to the puzzle.

    You need to start with a product field for the base price which I just set to £0.00.

    Then create your option fields (like Finish in my example).

    Then create your number input fields (Height and Width).

    Then create calculation fields for all the different combinations of options. I called the calculation fields "Sub Total". Use conditional logic on the calculation field so it only shows when the relevant option is selected.

    The actual calculation that goes into the calculation field is the Height field * the Width field * the price of the selected option.

    You finally need a total field to generate the final price.

    I hope that makes sense!

    Cheers,

    Dave

  9. jescarcha
    Member
    Posted 1 year ago #

    Thanks for your explanation.

    My calculations run as described using your method but the option total gets added to the total again. Did you run into this issue?

    Thanks

  10. Deaner666
    Member
    Posted 1 year ago #

    I'm not entirely sure what you mean, but I've just had a quick look and in the Gravity Forms Product Add-ons section in the product, underneath "Total Calculations" I've got Disable Sub-Total checked, Disable Options Label checked and Disable Total Label UNchecked.

    Not sure if any of that will make a difference?

  11. jescarcha
    Member
    Posted 1 year ago #

    Let's say that my options totaled to $140:

    When i perform the "Sub Total" calculations it equals to $1120

    However, the total gets displayed as $1272.
    The problem as I see it is that my options total AND my base price is getting added to the total.
    $1120 + $140 + $12 (base price) = $1272

    Hopefully that clears up my problem.

  12. Deaner666
    Member
    Posted 1 year ago #

    I still don't follow I'm afraid. Are you using the area calculation as well? I think I'd need to see the form to understand fully what you're doing.

    The only think I would say is that my base price was £0.00.

  13. jescarcha
    Member
    Posted 1 year ago #

    What did you set your regular price as in the woocommerce product page?

  14. Deaner666
    Member
    Posted 1 year ago #

    Regular price was also £0.00.

  15. jescarcha
    Member
    Posted 1 year ago #

    I appreciate all of the assistance that you have provided me Deaner666. I am just one step away from having this solution work.

    https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-ash3/q71/945623_10201193729580418_801895647_n.jpg

    This link shows the issue that I mentioned earlier. For some reason my Sub Total calculations field and my Totals field are not the same. In the specific screenshot above, it seems that the amount in the option total (Basswood / Filler Option Total) is getting added to the Sub Total which gives me the price in the Total.

    What version of gravity forms product add ons are you using? Is there a setting that I am missing?

  16. Deaner666
    Member
    Posted 1 year ago #

    Are you using the total provided by woocommerce or the total provided by Gravity Forms? Although you have to have a Total field at the end of your form, I've set the CSS class name in the advanced tab for that field to "hidden-total", which hides it from the user. So the user isn't ever seeing the Gravity Forms total, only the one from Woocommerce.

    Not sure if this will make the difference, but might be worth a try.

    Can you show me exactly what's in the sub total calculation fields?

  17. Deaner666
    Member
    Posted 1 year ago #

    Ah. I just thought of something else...

    In my example:

    http://www.print-2-media.com/shop/banners/pvc-banners-510gsm-heavy-weight-single-sided/

    The "finishing" radio button field is NOT an options field. It's just a normal radio button field which the calculation fields use to determine the price multiplication factor.

    If it were an "options" field then the price associated with each option would get added to the total, which may be where you're getting a problem.

    I realise my initial instructions were confusing on this point (because I'd forgotten it myself!), so I'm really sorry!

    Cheers,

    Dave

  18. codeworxx
    Member
    Posted 1 year ago #

    Hi @Deaner666,

    how do you update the pricing field so that the correct price is added to cart?

    For example:
    I have a product for e.g. $30. I have a text field where 15 chars. free, each additional is $0.10. So i have created a JS calculation. Now i want to update the the pricing field to $30.50 and add to cart. Which field has to be updated? You know what i mean?

    Thanks!

  19. Deaner666
    Member
    Posted 1 year ago #

    @codeworxx - are you using Woocommerce and Gravity Forms with the Gravity Forms Product Addons?

  20. codeworxx
    Member
    Posted 1 year ago #

    No - only WooCommerce and the WooCommerce Product Addon (http://www.woothemes.com/products/product-add-ons/).

  21. Deaner666
    Member
    Posted 1 year ago #

    @codeworxx - I'm sorry, I wouldn't know the answer to that. I've not got any experience of manipulating the Woocommerce fields via Javascript.

    I can recommend Gravity Forms and the gravity forms product addons extension. It means when WordPress / Woocommerce or your theme are updated, somebody else is doing the work of updating the code to match (otherwise you have to go back through all the sites you run to update your own bit of code).

  22. codeworxx
    Member
    Posted 1 year ago #

    Ok, but does Gravitiy update the pricing?

  23. Deaner666
    Member
    Posted 1 year ago #

    I've never used it for your specific use-case, so I can't be totally sure. You could try the Gravity Forms forums:

    http://www.gravityhelp.com/forums/

  24. jescarcha
    Member
    Posted 1 year ago #

    @Deaner666

    That was the trick! It works as described and explained now.

    However there is one more thing that I need clarification on now (as it usually goes when implementing functionality):

    When I set up my drop down fields and radio buttons, I set the value as just the price for that particular option (ex:https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-prn2/q71/1045239_10201200692714492_629984526_n.jpg). As a result when the product variations are displayed in the cart it only displays that price value. I'd like for it to display the field label as in your example.
    (Here is a link to a screenshot comparing variation displays from each of our sites: https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-prn2/1045067_10201200644193279_2095602698_n.jpg)

    Thanks!

  25. Deaner666
    Member
    Posted 1 year ago #

    Ah... that one's easy ;-)

    You just have to set the value to be the same as the label.

    I can't remember if conditional logic uses the label or the value. If it uses the value you'll have to update the conditions in your calculation fields.

    Glad you've got it working!

    Cheers,

    Dave

  26. jescarcha
    Member
    Posted 1 year ago #

    Wouldn't that mess with the calculations?

  27. Deaner666
    Member
    Posted 1 year ago #

    Do you mean you're using the number in your radio field value directly in your calculation?

    That's not how mine works. For each radio button in the radio group, I have a calculation field that is only shown (via conditional logic on the field) when that radio button is selected.

    Here's an example of the calculation that is applied when someone chooses "Hems and eyelets - £22.50 per m2"

    (({Width:5} / 100) * ({Height:4} / 100)) * 22.5

    As you can see - the 22.50 is hard coded in the calculation, so the value on the radio button can be whatever you want. It's only used to determine which calculation field to apply.

    If you choose "Unhemmed, no eyelets - £20 per m2", then a different calculation field is applied (via conditional logic) with the following calculation:

    (({Width:5} / 100) * ({Height:4} / 100)) * 20

    Does this make sense?

  28. jescarcha
    Member
    Posted 1 year ago #

    I was able to make my implementation match the needed functionality.

    Thank you very much for all of your help Deaner666!

  29. Deaner666
    Member
    Posted 1 year ago #

    No probs. Glad you got it working. It took me a lot of working out to get it sorted so I'm glad to be able to pass it on to someone else!

    Have you got a link you can share so I can see it in action? I'm curious now!

    Cheers,

    Dave

  30. jescarcha
    Member
    Posted 1 year ago #

    I'm currently finishing up the site now and it is not live. It will be in the next week though. I'll keep you posted!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic