All things Shopify and commerce
We need to update the variant title by REST API
I already coded for the updated Title in PHP but still have not updated it. The Code is running successfully.
That is PHP Code please give me Solution
$shopifyStore = SHOP . '.myshopify.com'; $apiKey = API_KEY; $password = PASSWORD; $apiKey = API_KEY; $password = PASSWORD; $shopUrl = $shopifyStore; $variantId = $QUR[0]['shopify_product_variant_id']; // Replace with the actual variant ID $newVariantTitle = base64_decode($QUR[0]['item_name']); // Replace with the desired new title $apiUrl = "https://$apiKey:$password@$shopUrl/admin/api/" . APIV; $variantData = [ 'variant' => [ 'id' => $variantId, 'title' => $newVariantTitle, ], ]; //pre($variantData); echo "$apiUrl/variants/$variantId.json"; $ch = curl_init("$apiUrl/variants/$variantId.json"); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($variantData)); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', ]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error updating variant title: ' . curl_error($ch); } else { $responseData = json_decode($response, true); pre($responseData); }
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025