php-shopify icon indicating copy to clipboard operation
php-shopify copied to clipboard

how to remove a file from a theme?

Open kubatbekov opened this issue 4 years ago • 2 comments

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' ]);

kubatbekov avatar Jan 29 '21 07:01 kubatbekov

Yes, you are passing the parameters incorrectly.

Try it this way

$this->shopifySDK->Theme($themeId)->Asset->delete([ 'asset[key]' => 'assets/style.css' ]);

anikghosh256 avatar Feb 04 '21 12:02 anikghosh256

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.

phpcontrols avatar Jul 02 '21 21:07 phpcontrols