phpclassic / php-shopify

PHP SDK for Shopify API
Apache License 2.0
570 stars 210 forks source link

Deleting Script Tag #169

Closed sjranjan closed 4 years ago

sjranjan commented 4 years ago

i was able to create script tag as follows...

$shopify->ScriptTag->post(array('src' => 'URL', 'event' => 'onload'));

Since i executed it many times the file is being loaded several times (many script tags added). Now am trying to delete it. But unable to do so. I read script tags as follows... $result = $shopify->ScriptTag->get(array('src' => 'URL')); and i got all script tags in array... Then i tried deleting it in following ways...

$shopify->ScriptTag->delete(SCRIPT_TAG_ID); $shopify->ScriptTag->delete(array('id' =>SCRIPT_TAG_ID)); $shopify->ScriptTag->delete(array('script_tag_id' =>SCRIPT_TAG_ID));

nothing works... all fails with result " Request failed with HTTP Code 406. "

how to delete script tag ?

tareqtms commented 4 years ago

Try this:

$shopify->ScriptTag(SCRIPT_TAG_ID)->delete();