Skip to content

Commit

Permalink
update pricing api + version
Browse files Browse the repository at this point in the history
  • Loading branch information
Sami Kerboute committed Jul 3, 2020
1 parent 348ca92 commit 64b68d6
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 3 deletions.
145 changes: 145 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# ShoppingFeed

WordPress connection Controller Plugin for ShoppingFeed - Sell on Amazon, Ebay, Google, and 1000's of international marketplaces

## Requirements

### Server :
- PHP version 5.6 or above
- PHP cURL extension is activated

### WordPress :

- Core version 5.2 or above
- WooCommerce version 3.8 or above



## Installation

Sign up for free on ShoppingFeed : https://shopping-feed.com/

- Activate the plugin in Plugins > Installed Plugins
- In Plugins > Installed Plugins > ShoppingFeed > settings, log in with your ShoppingFeed credentials
- In Settings, check that ShoppingFeed is enabled and save changes

## Configuration

To start using the plugin correctly, you need to configure it with your preferences (Feed, Shipping, Orders)















## Available hooks

With this snippets below can be added to your theme's functions.php file or your custom plugin file

### Categories
By default, we support `product_cat` as taxonomy slug to identify product's categories, you can override it using this snippet :


```php
add_filter( 'shopping_feed_custom_category_taxonomy', 'your_custom_category_function' );
/** @return string */
function your_custom_category_function() {
return 'your_custom_category_slug';
}
```

### Brands
By default, we don’t support any custom plugin for product's brand, you can set custom taxonomy slug to identify it by using this snippet :

```php
add_filter( 'shopping_feed_custom_brand_taxonomy', 'your_custom_brand_function' );
/** @return string */
function your_custom_brand_function() {
return 'your_custom_brand_slug';
}
```

### EAN
By default, we don’t support any custom plugin for product EAN, you can set custom taxonomy slug to identify it by using this snippet :

```php
add_filter( 'shopping_feed_custom_ean', 'your_custom_ean_function' );
/** @return string */
function your_custom_ean_function() {
return 'your_custom_ean_slug';
}
```





### Feed’s products list args
To export the feed, we use the plugin’s setting, if you want to add/use specific args, you can use the following snippet

```php
add_filter( 'shopping_feed_products_custom_args', 'your_custom_args_function' );
/**
* @return array
*/
function your_custom_args_function() {
//array of args
return array();
}
```
`you can find all available args here` - __[WooCommerce documentation](https://github.com/woocommerce/woocommerce/wiki/wc_get_products-and-WC_Product_Query#parameters)__

### Orders to import (statuses)
By default, we import orders with ‘waiting_shipment’ status, if you want to import more statuses or a specific one, you can use the following snippet

```php
add_filter( 'shopping_feed_orders_to_import', 'your_custom_statuses_function' );
/** @return array */
function your_custom_statuses_function() {
//array of statuses (strings)
return array();
}
```
`Status available` : created, waiting_store_acceptance, refused, waiting_shipment, shipped, cancelled, refunded, partially_refunded, partially_shipped

__[more details here](https://github.com/shoppingflux/php-sdk/blob/master/docs/manual/resources/order.md)__










### Tracking number
By default, we don’t support any custom plugin for wc order tracking number, you can set custom meta key to identify it, you can use the following snippet

```php
add_filter( 'wc_tracking_number', 'your_custom_tracking_number_function' );
/** @return string */
function your_custom_tracking_number_function() {
return ‘your_custom_order_meta_key’
}
```

### Tracking url
By default, we don’t support any custom plugin for wc order tracking url, you can set custom meta key to identify it, you can use the following snippet

```php
add_filter( 'wc_tracking_url', 'your_custom_tracking_url_function' );
/** @return string */
function your_custom_tracking_url_function() {
return ‘your_custom_order_meta_key’
}
```
2 changes: 1 addition & 1 deletion shoppingfeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author URI: https://www.shopping-feed.com/
* Text Domain: shopping-feed
* Domain Path: /languages
* Version: 1.0.0
* Version: 6.0.0
* Requires at least WP: 5.2
* Requires at least WooCommerce: 3.8 (3.9/4.0)
* Requires PHP: 5.6
Expand Down
4 changes: 2 additions & 2 deletions src/Admin/WoocommerceActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function update_product( $product_id, $only_stock = false ) {
continue;
}

$this->may_update_pricing( $variation['sku'], $variation['price'] );
$this->may_update_pricing( $variation['sku'], ! empty( $variation['discount'] ) ? $variation['discount'] : $variation['price'] );
$this->may_update_inventory( $variation['sku'], $variation['quantity'] );
}
} else {
Expand All @@ -206,7 +206,7 @@ public function update_product( $product_id, $only_stock = false ) {
return false;
}

$this->may_update_pricing( $product->get_sku(), $product->get_price() );
$this->may_update_pricing( $product->get_sku(), ! empty( $product->get_discount() ) ? $product->get_discount() : $product->get_price() );
$this->may_update_inventory( $product->get_sku(), $product->get_quantity() );
}
/**
Expand Down

0 comments on commit 64b68d6

Please sign in to comment.