Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

How to set the costPerItem of variant when I create a new product

How to set the costPerItem of variant when I create a new product

loganaa
Shopify Partner
12 1 0

A9D20B4F-A262-4EFF-93FA-8416E8682420.png

 

 

Hello everyone, I want to custom the CostPerItem of variant when I create a new product with request which is 

/admin/api/2023-01/products.json

 

 

I found that the API document do not have this parameter and I also try to use `cost_per_item` but it not worked.

My request body json:

{
	"body_html": "<ul><li><span style=\"color: rgb(32, 32, 32); font-size: 16px;\"><strong>Production Process</strong></span><span style=\"color: rgb(102, 102, 102);\">: Thermal Transfer Printing</span></li><li><span style=\"color: rgb(32, 32, 32); font-size: 16px;\"><strong>Material Description</strong></span><span style=\"color: rgb(102, 102, 102);\">: 90% Polyester+10% Spandex </span></li><li><span style=\"color: rgb(32, 32, 32); font-size: 16px;\"><strong>Product Performance</strong></span><span style=\"color: rgb(102, 102, 102);\">: Full printing: Sophisticated full printing technique meets your various customization demands.Top-grade material and sewing: The premium 250g/sm fabric and four-needle six-line sewing ensures its top quality for durability. Maximum comfort: Adopting breathable, high-elastic and moisture absorption fabric, the Yoga Pants keep you cool while doing yoga and other sports. The high waist and wide band also offer you maximum comfort. And its special black lines highlights your body curve. Thoughtful pockets: Two thoughtful side pockets are convenient for you to carry some little stuffs.Show your personality: Printed with distinctive patterns, the Yoga Pants with lines make you stylish, charming and confident.</span></li><li><span style=\"color: rgb(32, 32, 32); font-size: 16px;\"><strong>Applicable Scenarios</strong></span><span style=\"color: rgb(102, 102, 102);\">: It enables you to enjoy the fun of doing sports, like yoga and running.</span></li><li><span style=\"color: rgb(32, 32, 32); font-size: 16px;\"><strong>Washing Instructions</strong></span><span style=\"color: rgb(102, 102, 102);\">: Hand washing under 45 degrees Centigrade. Do not bleach or soak for a long time.</span></li><li><span style=\"color: rgb(32, 32, 32); font-size: 16px;\"><strong>Special Description</strong></span><span style=\"color: rgb(102, 102, 102);\">: The product is European size. Please contact customer service for advice, if any problem. Please allow 1-2 cm measuring deviation due to manual measurement. Ensure the color of your design picture different from that of the product, otherwise the ink will not come out during the printing. The above conditions are NOT within the scope of the warranty and service.</span></li><li><span style=\"color: rgb(32, 32, 32); font-size: 16px;\"><strong>Reminder</strong></span><span style=\"color: rgb(102, 102, 102);\">: Please note that all pictures shown on our website are for illustration purpose only and actual products may vary due to product enhancement or change. Please allow a small difference in color, location and size due to production batches, machines and other objective factors. The above conditions are not within the scope of the warranty and service.</span></li></ul><p></p><p><span style=\"font-family: ProximaNova-Bold;color:#666;font-size:16px;\">Quality Yoga Pants with Pockets-Full Printing</span></p><table><tr><th><span style=\"color:#666;\">Size</span></th><th><span style=\"color:#666;\">Length (cm/in)</span></th><th><span style=\"color:#666;\">1/2 Waist (cm/in)</span></th><th><span style=\"color:#666;\">1/2 Hip (cm/in)</span></th></tr><tr><td><span style=\"color:#666;\">S</span></td><td><span style=\"color:#666;\">88/34.6</span></td><td><span style=\"color:#666;\">31.5/12.4</span></td><td><span style=\"color:#666;\">37.5/14.8</span></td></tr><tr><td><span style=\"color:#666;\">M</span></td><td><span style=\"color:#666;\">91/35.8</span></td><td><span style=\"color:#666;\">34/13.4</span></td><td><span style=\"color:#666;\">40/15.7</span></td></tr><tr><td><span style=\"color:#666;\">L</span></td><td><span style=\"color:#666;\">94/37</span></td><td><span style=\"color:#666;\">36.5/14.4</span></td><td><span style=\"color:#666;\">42.5/16.7</span></td></tr><tr><td><span style=\"color:#666;\">XL</span></td><td><span style=\"color:#666;\">97/38.2</span></td><td><span style=\"color:#666;\">39/15.4</span></td><td><span style=\"color:#666;\">45/17.7</span></td></tr><tr><td><span style=\"color:#666;\">2XL</span></td><td><span style=\"color:#666;\">100/39.4</span></td><td><span style=\"color:#666;\">41.5/16.3</span></td><td><span style=\"color:#666;\">47.5/18.7</span></td></tr></table>",
	"images": [{
		"src": "https://cdn.bigollo.com/output/m/254/76b7f04e9708a9db3924131120f7c134.jpg"
	}, {
		"src": "https://cdn.bigollo.com/output/m/254/9c123be101a7b13855ad4e1f51b08b83.jpg"
	}, {
		"src": "https://cdn.bigollo.com/output/m/254/9c9b7cc135401c4bc62c7d4e579c2e2f.jpg"
	}, {
		"src": "https://cdn.bigollo.com/output/m/254/6ad2410bd904e066795966ba9df3195f.jpg"
	}, {
		"src": "https://cdn.bigollo.com/output/m/254/d821289c4e66148225d48251b99d799d.jpg"
	}],
	"options": [{
		"name": "Color",
		"values": ["White", "Black"]
	}, {
		"name": "Size",
		"values": ["S", "M", "L", "XL", "2XL"]
	}],
	"product_type": "",
	"tags": [],
	"title": "20230113",
	"variants": [{
		"barcode": "",
		"cost_per_item": 11.31,
		"fulfillment_service": "bigollo",
		"option1": "White",
		"option2": "S",
		"price": 124.41,
		"requires_shipping": true,
		"sku": "ejlv0s6w1lh7",
		"weight": 249.00,
		"weight_unit": "g"
	}, {
		"barcode": "",
		"cost_per_item": 11.31,
		"fulfillment_service": "bigollo",
		"option1": "Black",
		"option2": "S",
		"price": 124.41,
		"requires_shipping": true,
		"sku": "ejlv0stp5e4c",
		"weight": 249.00,
		"weight_unit": "g"
	}, {
		"barcode": "",
		"cost_per_item": 11.31,
		"fulfillment_service": "bigollo",
		"option1": "White",
		"option2": "M",
		"price": 124.41,
		"requires_shipping": true,
		"sku": "ejlv0s6mfjcr",
		"weight": 269.00,
		"weight_unit": "g"
	}, {
		"barcode": "",
		"cost_per_item": 11.31,
		"fulfillment_service": "bigollo",
		"option1": "Black",
		"option2": "M",
		"price": 124.41,
		"requires_shipping": true,
		"sku": "ejlv0stuvjz8",
		"weight": 269.00,
		"weight_unit": "g"
	}, {
		"barcode": "",
		"cost_per_item": 11.31,
		"fulfillment_service": "bigollo",
		"option1": "White",
		"option2": "L",
		"price": 124.41,
		"requires_shipping": true,
		"sku": "ejlv0s6vh01k",
		"weight": 289.00,
		"weight_unit": "g"
	}, {
		"barcode": "",
		"cost_per_item": 11.31,
		"fulfillment_service": "bigollo",
		"option1": "Black",
		"option2": "L",
		"price": 124.41,
		"requires_shipping": true,
		"sku": "ejlv0snmwvs1",
		"weight": 289.00,
		"weight_unit": "g"
	}, {
		"barcode": "",
		"cost_per_item": 11.31,
		"fulfillment_service": "bigollo",
		"option1": "White",
		"option2": "XL",
		"price": 124.41,
		"requires_shipping": true,
		"sku": "ejlv0s6hspm9",
		"weight": 309.00,
		"weight_unit": "g"
	}, {
		"barcode": "",
		"cost_per_item": 11.31,
		"fulfillment_service": "bigollo",
		"option1": "Black",
		"option2": "XL",
		"price": 124.41,
		"requires_shipping": true,
		"sku": "ejlv0snv7eyv",
		"weight": 309.00,
		"weight_unit": "g"
	}, {
		"barcode": "",
		"cost_per_item": 11.31,
		"fulfillment_service": "bigollo",
		"option1": "White",
		"option2": "2XL",
		"price": 124.41,
		"requires_shipping": true,
		"sku": "ejlv0sbw5bew",
		"weight": 329.00,
		"weight_unit": "g"
	}, {
		"barcode": "",
		"cost_per_item": 11.31,
		"fulfillment_service": "bigollo",
		"option1": "Black",
		"option2": "2XL",
		"price": 124.41,
		"requires_shipping": true,
		"sku": "ejlv0sngrj9j",
		"weight": 329.00,
		"weight_unit": "g"
	}],
	"vendor": "SALE_DESIGN-PERSONAL DESIGN"
}

 

Hope someone can help me, extremely grateful.

 

Replies 0 (0)