2020-06-05 16:49:07 +00:00
/ * *
* The default fixtures data is shaped according to WC REST API
*
* @ see { @ link https : //woocommerce.github.io/woocommerce-rest-api-docs|WooCommerce REST API}
* /
/ * *
* Coupons fixture data , using the create batch endpoint
*
* @ see { @ link https : //woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-coupons|Batch update coupons}
* /
const Coupons = ( ) => [
{
code : 'coupon' ,
discount _type : 'fixed_cart' ,
amount : '5' ,
} ,
{
code : 'oldcoupon' ,
discount _type : 'fixed_cart' ,
amount : '5' ,
date _expires : '2020-01-01' ,
} ,
{
code : 'below100' ,
discount _type : 'percent' ,
amount : '20' ,
maximum _amount : '100.00' ,
} ,
{
code : 'above50' ,
discount _type : 'percent' ,
amount : '20' ,
minimum _amount : '50.00' ,
} ,
{
code : 'a12s' ,
discount _type : 'percent' ,
amount : '100' ,
individual _use : true ,
email _restrictions : '*@automattic.com%2C *@a8c.com' ,
} ,
{
code : 'freeshipping' ,
discount _type : 'percent' ,
amount : '0' ,
free _shipping : true ,
} ,
] ;
/ * *
* Reviews fixture data , using the create batch endpoint
*
* @ see { @ link https : //woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-product-reviews|Batch update product reviews}
* @ param { number } id Product ID to add reviews to .
* /
const ReviewsInProduct = ( id ) => [
{
product _id : id ,
review : 'Looks fine' ,
reviewer : 'John Doe' ,
reviewer _email : 'john.doe@example.com' ,
rating : 4 ,
} ,
{
product _id : id ,
review : 'I love this album' ,
reviewer : 'John Doe' ,
reviewer _email : 'john.doe@example.com' ,
rating : 5 ,
} ,
{
product _id : id ,
review : 'a fine review' ,
reviewer : "John Doe' niece" ,
reviewer _email : 'john.doe@example.com' ,
rating : 5 ,
} ,
] ;
2020-07-06 18:48:39 +00:00
/ * *
* Product category fixture data , using the create batch endpoint
*
* @ see { @ link https : //woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-product-categories|Batch update product categories}
* /
const Categories = ( ) => [
{
name : 'Music' ,
} ,
] ;
2020-06-05 16:49:07 +00:00
/ * *
* Product fixture data , using the create batch endpoint
*
* @ see { @ link https : //woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-products|Batch update products}
* /
const Products = ( ) => [
{
name : 'Woo Single #1' ,
type : 'simple' ,
regular _price : '21.99' ,
virtual : true ,
downloadable : true ,
downloads : [
{
name : 'Woo Single' ,
file :
'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg' ,
} ,
] ,
images : [
{
src :
'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg' ,
} ,
] ,
2020-07-06 18:48:39 +00:00
categories : [ 'Music' ] ,
} ,
{
name : 'Woo Single #2' ,
type : 'simple' ,
regular _price : '25.99' ,
virtual : true ,
downloadable : true ,
downloads : [
{
name : 'Woo Single 2' ,
file :
'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg' ,
} ,
] ,
images : [
{
src :
'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg' ,
} ,
] ,
categories : [ 'Music' ] ,
2020-06-05 16:49:07 +00:00
} ,
] ;
/ * *
* Settings fixture data , using the update batch endpoint .
*
* @ see { @ link https : //woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-setting-options|Batch update setting options}
* /
const Settings = ( ) => [
{
id : 'woocommerce_store_address' ,
value : '60 29th Street #343' ,
} ,
{
id : 'woocommerce_store_city' ,
value : 'San Francisco' ,
} ,
{
id : 'woocommerce_store_country' ,
value : 'US:CA' ,
} ,
{
id : 'woocommerce_store_postcode' ,
value : '94110' ,
} ,
{
id : 'woocommerce_allowed_countries' ,
value : 'specific' ,
} ,
{
id : 'woocommerce_specific_allowed_countries' ,
value : [ 'DZ' , 'CA' , 'NZ' , 'ES' , 'GB' , 'US' ] ,
} ,
{
id : 'woocommerce_ship_to_countries' ,
value : 'specific' ,
} ,
{
id : 'woocommerce_specific_ship_to_countries' ,
value : [ 'DZ' , 'CA' , 'NZ' , 'ES' , 'GB' , 'US' ] ,
} ,
{
id : 'woocommerce_enable_coupons' ,
value : 'yes' ,
} ,
{
id : 'woocommerce_calc_taxes' ,
value : 'yes' ,
} ,
{
id : 'woocommerce_currency' ,
value : 'USD' ,
} ,
] ;
/ * *
* Shipping Zones fixture data , using the shipping zone endpoint , shipping
* location , and shipping method endpoint .
*
* @ see { @ link https : //woocommerce.github.io/woocommerce-rest-api-docs/#create-a-shipping-zone|Create a shipping zone}
* * @ see { @ link https : //woocommerce.github.io/woocommerce-rest-api-docs/#update-a-locations-of-a-shipping-zone|Update a locations of a shipping zone}
* * @ see { @ link https : //woocommerce.github.io/woocommerce-rest-api-docs/#include-a-shipping-method-to-a-shipping-zone|Include a shipping method to a shipping zone}
* /
const Shipping = ( ) => [
{
name : 'UK' ,
locations : [
{
code : 'UK' ,
} ,
] ,
methods : [
{
method _id : 'flat_rate' ,
settings : {
title : 'Normal Shipping' ,
cost : '20.00' ,
} ,
} ,
{
method _id : 'free_shipping' ,
settings : {
title : 'Free Shipping' ,
cost : '00.00' ,
requires : 'coupon' ,
} ,
} ,
] ,
} ,
] ;
/ * *
* Taxes rates fixture data , using the create batch endpoint .
*
* @ see { @ link https : //woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-tax-rates|Batch update tax rates}
* /
const Taxes = ( ) => [
{
country : 'US' ,
rate : '5.0000' ,
name : 'State Tax' ,
shipping : false ,
priority : 1 ,
} ,
{
country : 'US' ,
rate : '10.000' ,
name : 'Sale Tax' ,
shipping : false ,
priority : 2 ,
} ,
{
country : 'UK' ,
rate : '20.000' ,
name : 'VAT' ,
shipping : false ,
} ,
] ;
module . exports = {
Coupons ,
ReviewsInProduct ,
2020-07-06 18:48:39 +00:00
Categories ,
2020-06-05 16:49:07 +00:00
Products ,
Settings ,
Shipping ,
Taxes ,
} ;