BNMetrics / Laravel-ShopifyAPI

Shopify Laravel API Wrapper ( with Billing support!)
MIT License
53 stars 29 forks source link

Setting default address #12

Closed webstik closed 6 years ago

webstik commented 6 years ago

Hello,

I'm trying to modify the default address of the customer . For that purpose I'm trying to use the endpoint (https://help.shopify.com/api/reference/customer_address#default) modifyCustomersAddressesDefault in this way: $shopify->modifyCustomersAddressesDefault(['customer_id'=>'447150227516', 'address_id'=>'525468663868']); and in this way: $shopify->modifyCustomersAddressesDefault('447150227516','525468663868');

in shopify.php I have :

'endpoints'   => [
....
        'customers'          => [
            'addresses'
        ]
];

but it produced following error: Exception: Must define tier one endpoint! in file /home/vagrant/code/power-app/vendor/bnmetrics/laravel-shopify-api/src/Endpoints.php on line 83

So, what is the correct way to modify the customer's default address?

BNMetrics commented 6 years ago

Hi there @webstik Sorry for the late response.

Since default is not one of the standard "All", "Count", "ById" call, you will need to include the last part of parameter like this:

$shopify->modifyCustomersAddressesById('default', ['customer_id'=>'447150227516', 'address_id'=>'525468663868']);

Hope it helps! Luna

webstik commented 6 years ago

Actually the way to do that is with this:

$shopify->modifyCustomersAddresses('default', 447150227516, 525468663868);

Also in the config we should add:

'tierTwoWithoutId' => ['customers'],

Thanks for your help