Is there any extension target in order total summary just above total.

Is there any extension target in order total summary just above total.

Surabhigupta
Shopify Partner
1 0 0

Hi,
Is there any extension target in order total summary. I am not able to find any such target in documentation.
I am referring from this documentation https://shopify.dev/docs/api/checkout-ui-extensions/2023-10/targets
I need to add some detail just before total or after tax detail.
Checkout-fodev-mobikasa.png

Replies 9 (9)

Liam
Shopify Staff
2873 312 821

Hi Surabhigupta,

 

The closest target extension would be the purchase.checkout.reductions.render-after target that is rendered in the order summary, after the discount form and discount tag elements. There doesn't appear to be an target for the specific area you're looking for, but I've added this as a feature request for the product team. 

 

Hope this helps,

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Schmidtc63
Shopify Partner
96 14 25

Any update on this?

garyrgilbert
Shopify Partner
414 41 170

@Liam 

 

I have a quick question for you, well maybe its quick 🙂

 

I've been tasked to, as best I can, convert all manner of checkout customizations to checkout extensions. One particular checkout customization hides the line_item property of a particular product in the order summary area.

 

The text in the red box.

 

garyrgilbert_1-1720714260843.png

Is there any way to achieve this with checkout extensions? I think its a line_item property

 

Cheers,

 

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution

Schmidtc63
Shopify Partner
96 14 25

Are you looking for something like this:

Schmidtc63_0-1720715402241.png

 

I used "purchase.checkout.block.render" to create our "kp-display-billing-currency-summary" and then dragged the application block to below the Order Summary Subtotal:

Schmidtc63_1-1720715542777.png

 

 

garyrgilbert
Shopify Partner
414 41 170

Hey Schmidt,

 

Nope.

 

Upon further investigation (I didnt write the intial code) the Montageservice (assembly service) has a base price of 1k, and depending on the product a discount is applied to the product to achieve the desired price of 300 for the bunkbed assembly. Apparently they don't want to confuse the customer by showing them the discount of 700 on the Montageservice line item.  I was hoping to be able to block the display of that, but since its an applied discount to the line item I'm thinking its not going to work.  I'm going to have to see if we can achieve the desired affect by having variants in the Montageservice with all possible prices, and then add the variant instead of applying discounts.

 

Cheers and thanks anyway for posting.

 

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Schmidtc63
Shopify Partner
96 14 25

I wasn't replying to you. I was replying to the OP. You injected a completely separate topic into the original post.

garyrgilbert
Shopify Partner
414 41 170

Sorry, thats true 🙂

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Schmidtc63
Shopify Partner
96 14 25

In your case, I would just write a line-item transform function and set the price to whatever you wish...

// @TS-check

/**
 * @typedef {import("../generated/api").RunInput} RunInput
 * @typedef {import("../generated/api").FunctionRunResult} FunctionRunResult
 * @typedef {import("../generated/api").CartOperation} CartOperation
 */

/**
 * @type {FunctionRunResult}
 */
const NO_CHANGES = {
	operations: [],
};

/**
 * @param {RunInput} input
 * @returns {FunctionRunResult}
 */
export function run(input) {

	const operations = input.cart.lines.reduce(
		/** @param {CartOperation[]} acc */
		(acc, cartLine) => {
			const updateOperation = optionallyBuildUpdateOperation(
				cartLine
			);

			if (updateOperation) {
				return [...acc, {update: updateOperation}];
			}

			return acc;
		},
		[]
	);

	return operations.length > 0 ? {operations} : NO_CHANGES;
}

/**
 * @param {RunInput['cart']['lines'][number]} cartLine
 */
function optionallyBuildUpdateOperation(
	{id: cartLineId) {
	if (merchandise.product.title !== `Montagservice`) {
		return;
	}
	if (
		merchandise.__typename === `ProductVariant`
	) {

		return {
			cartLineId,
			price: <WHATEVER PRICE YOU WANT>
			},
		};
	}

	return null;
}
garyrgilbert
Shopify Partner
414 41 170

Thanks for the example code,

I will have to set up a meeting with the client to discuss this since I never built the original implementation I am wondering if its calculable or fixed based and then how to get the info into the input. 

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution