pixelpeter / laravel5-woocommerce-api-client

Laravel 5 wrapper for the Woocommerce REST API
MIT License
126 stars 48 forks source link

he i have small question #35

Closed almokhtarbr closed 6 years ago

almokhtarbr commented 6 years ago

i have web app built with laravel and a website with wordpress (woocomerce) so i want to get all orders from this site so my question if i have more than 1 website with woocomerce what i must do ? Salutaions

pixelpeter commented 6 years ago

I don't get exactly what you mean. You have one Laravel application that will get orders from multiple Woocommerce stores?

almokhtarbr commented 6 years ago

@pixelpeter exactly that what i mean .

HeathMorrisCode commented 6 years ago

I have the same question! I have 3 separate WooCommerce shops that I would like to pull order data from. I'm wondering if there is an easy way to retrofit this library to do that, or if I should just use the official PHP wrapper. Keep up the great work, this library has been hugely useful for me, thanks again!

pixelpeter commented 6 years ago

This package is made for easy integration with Laravel 5.* using facades. That's why multiple shops are NOT supported.

You can initialize it as a normal object given a specific config array for every shop.... ... but then you could also use the official woocommer php api


$this->shop_1 = new WoocommerceClient(new Automattic\WooCommerce\Client(
    $config_1['store_url'],
    $config_1['consumer_key'],
    $config_1['consumer_secret'],
    [
        'version' => 'wc/'.$config_1['api_version'],
        'verify_ssl' => $config_1['verify_ssl'],
        'wp_api' => $config_1['wp_api'],
        'query_string_auth' => $config_1['query_string_auth'],
        'timeout' => $config_1['timeout'],
    ]
));

$this->shop_2 = new WoocommerceClient(new Automattic\WooCommerce\Client(
    $config_2['store_url'],
    $config_2['consumer_key'],
    $config_2['consumer_secret'],
    [
        'version' => 'wc/'.$config_2['api_version'],
        'verify_ssl' => $config_2['verify_ssl'],
        'wp_api' => $config_2['wp_api'],
        'query_string_auth' => $config_2['query_string_auth'],
        'timeout' => $config_2['timeout'],
    ]
));
HeathMorrisCode commented 6 years ago

Thanks @pixelpeter !