We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Shop

Showing buy now price and postage

I’m trying to work out the best way to put together a site to sell a single product which has 2 size variants (A3 and A4).

I’m trying to create something like:

<perch:form id="add_to_cart_a3" app="perch_shop" action="/shop/cart">
    <perch:input id="product" type="hidden" env-autofill="false" value="<perch:shop id="productID" type="hidden" env-autofill="false" />" />
    <button class="button a3" type="submit">
        <p>A3</p>
        <p>Buy now (£45.00)</p>
        <p>plus £7.50 P&amp;P</p>
    </button>
</perch:form>

<perch:form id="add_to_cart_a4" app="perch_shop" action="/shop/cart">
    <perch:input id="product" type="hidden" env-autofill="false" value="<perch:shop id="productID" type="hidden" env-autofill="false" />" />
    <button class="button a4" type="submit">
        <p>A4</p>
        <p>Buy now (£30.00)</p>
        <p>plus £5.00 P&amp;P</p>
    </button>
</perch:form>

Is it possible to get the price of the individual variants out and also the calculated postage (based on the variant size) to display with it?

Nick Bramwell

Nick Bramwell 5 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Shipping is calculated at the cart currently, as it's based on the total items rather than per-item.

How could we change this to make it work better?

I think it probably is only relevant for using buy now rather than a cart. As I understand there is no real difference currently, using a buy now style just cuts out the customer seeing the cart stage.

It would probably add too much complexity to create a completely different process for dealing with buy now buttons.

I’ve set up specific shopping methods for each size, so is it possible to output the price by calling it via the slug (or other id)?

How would I pull out the prices of individual variants to create the 2 buy now buttons with prices? Or would I need to make them 2 separate products to do that?

Drew McLellan

Drew McLellan 2638 points
Perch Support

How are you displaying the variants currently? We have "Page functions for displaying product variants" as an item on the roadmap at the moment.

Hello Drew,

I’ve been making progress and I now have:

<perch:productopts>
    <perch:productvalues>
        <perch:form id="opt-<perch:productvalue id="optionID" />[]" app="perch_shop" action="/shop/cart">
            <perch:input id="product" type="hidden" env-autofill="false" value="<perch:shop id="productID" type="hidden" env-autofill="false" />" />
            <button class="button" type="submit">
                <p><perch:productvalue id="valueTitle" /></p>
                <p>Buy now (£50.00)</p>
            </button>
        </perch:form>
    </perch:productvalues>
</perch:productopts>

<perch:showall />

It now cycles through the variants creating the buy now buttons.

Is there anything similar to <perch:productvalue id="valueTitle" /> which will show the price for the variant, or would that be part of the "page functions for displaying product variants"?

Drew McLellan

Drew McLellan 2638 points
Perch Support

There's not currently, because what you have there is the product options and option values, not the variants themselves.