Custom Pricing for Line Item

mjdth
Shopify Partner
13 1 3

I've seen this question asked several times and haven't found a definitive answer. I know it will involve creating a custom app (public or private, that's fine), but what is the best way to allow for custom pricing on a product during a checkout?

 

For example, have a $20 shirt, want the option to add $7 embellishment to the shirt so it will check out for $27. Not using variants, since there will be too many options, and the variants are used for sizing.

 

It can't really be done through the REST Admin API unless I created new variants for each checkout and then delete them. Can't be done using the Shopify Ajax API since prices cannot be modified.

 

It MIGHT be possible with the Checkout API using custom Line Items, but then I'd have to build the entire store process instead of using the shopify checkout process, I think?

 

Can someone point me in the direction of "this is how you can add an item to the cart with a custom price" no matter which API/SDK I need to use to properly achieve it?

 

Thanks

Patrick_Phelan
Shopify Partner
5 1 1

Some non-app options:

 

You could add a second $7 product with the same add to cart click and some JS and an "add embellishment" checkbox.

 

The product could start out at $27, but use the Line Item Script to discount it most of the time. (Scripts can not increase the price. Also requires Plus account.)

 

There are Liquid techniques to combine products to have many variants available on the product page, beyond the usual limits on variant counts.

 

0 Likes
GeniosWeb
New Member
1 0 1

Too bad something that basic made so complicated, or imposible, finger down


@Patrick_Phelan wrote:

Some non-app options:

 

You could add a second $7 product with the same add to cart click and some JS and an "add embellishment" checkbox.

 

The product could start out at $27, but use the Line Item Script to discount it most of the time. (Scripts can not increase the price. Also requires Plus account.)

 

There are Liquid techniques to combine products to have many variants available on the product page, beyond the usual limits on variant counts.

 



to shopify

tolgapaksoy
Shopify Partner
73 5 41

The way I do this is as followed:

 

I model all my checkouts using DraftOrders in my own app. DraftOrders can be modeled to have a variant_id, but a different price.

The nice thing about DraftOrders is that Shopify provides an invoice_url field that will turn your DraftOrder into a checkout, with the special pricing attached to it.

 

The only problem when doing this, is that you will need to create a custom cart app that will use DraftOrder API instead of Checkout API.

I_KNOW_NOTHING
Excursionist
31 0 6

Hi @tolgapaksoy,

From what i understand, when customer reached the cart page, you will run an API that use DraftOrders Endpoint, and when they click checkout, instead of redirecting them to '/checkout', you will redirect them to the invoice_url field.

Where can i find this invoice_url ?
Can you please explain what you mean when you said "you will need to create a custom cart app that will use DraftOrder API instead of Checkout API."

Thank you

0 Likes
PublicApps
Shopify Partner
89 4 25

Interesting solution.

Just trying to help out.
- If my reply was helpful, please Like it or mark it as Accepted Solution to let me know!
- Need store customizations? Then consider Hiring us.
0 Likes
artem_
New Member
1 0 0

@tolgapaksoy can you please share payload example?
I'm creating draft order with this payload and it ignores the price:

{
  "draft_order": {
    "line_items": [
      {
        "variant_id": 123456789,
        "quantity": 1,
        "price": "125.00"
      }
    ]
  }
}
0 Likes
ugifractal
New Member
1 0 0

@artem_ I got same issue, the new price just ignored

0 Likes