https://shopify.dev/docs/api/ajax/reference/cart#bundled-section-rendering
↑を参考にした
let formData = {
'items': [...this.items],
'sections':['cart-notification-product', 'cart-notification-button', 'cart-icon-bubble'],
'sections_url': window.location.pathname
};
fetch(window.Shopify.routes.root + 'cart/add.js', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(formData)
})
.then(response => {
console.log( response );
})
.catch((error) => {
console.error('Error:', error);
});
responceにsectionsが含まれて欲しいのですが返却値にありません。。
■返却されたデータ
■希望するレスポンス内容
{
attributes: {},
cart_level_discount_applications: [],
currency: "CAD",
item_count: 1,
items: [{…}],
items_subtotal_price: 100100,
note: null,
original_total_price: 100100,
requires_shipping: true,
sections: {
cart-items: "\n\n\n\n\n
",
cart-icon-bubble: "1 item\n
",
cart-live-region-text: "New subtotal: $1,001.00 CAD\n
",
cart-footer: "\n
\n \n\n\n\n\n\n\n\n"
},
token: "9ee5d43a08fb9a779828e42a4b6aa09a",
total_discount: 0,
total_price: 100100,
total_weight: 1000,
}
何か足りない部分があるのでしょうか?
よろしくお願いいたします。
