php-shopify
php-shopify copied to clipboard
how to remove a file from a theme?
I try to remove the file from the topic in this way but I get the answer from server ({"message":"Request failed with HTTP Code 406.","code":406,"status":false})
maybe I am passing parameters to the delete method incorrectly?
$this->shopifySDK = new PHPShopify\ShopifySDK($config);
$this->shopifySDK->Theme($themeId)->Asset->delete([ 'key' => 'assets/style.css' ]);
Yes, you are passing the parameters incorrectly.
Try it this way
$this->shopifySDK->Theme($themeId)->Asset->delete([ 'asset[key]' => 'assets/style.css' ]);
I assume adding a snippet would be sth like
$snippet = ["asset['key']" => "snippets/newsnippet.liquid", "value" => "hello"];
$shopify->Theme($themeId)->Asset->put($snippet);
It doesn't seem to work. Returns 406.