Merge remote-tracking branch 'woocommerce/master'
This commit is contained in:
commit
987616fdac
|
@ -19,7 +19,7 @@ ratings:
|
|||
exclude_paths:
|
||||
- "tests/"
|
||||
- "apigen/"
|
||||
- "dummy-data/"
|
||||
- "sample-data/"
|
||||
- "i18n/"
|
||||
- "includes/api/legacy/"
|
||||
- "includes/libraries/"
|
||||
|
|
|
@ -24,7 +24,7 @@ checks:
|
|||
filter:
|
||||
excluded_paths:
|
||||
- apigen/
|
||||
- dummy-data/
|
||||
- sample-data/
|
||||
- i18n/
|
||||
- includes/api/legacy/
|
||||
- includes/gateways/simplify-commerce/includes/
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
language: php
|
||||
|
||||
addons:
|
||||
chrome: stable
|
||||
apt:
|
||||
packages:
|
||||
- nginx
|
||||
|
||||
sudo: false
|
||||
|
||||
# Test main supported versions of PHP against latest WP.
|
||||
|
@ -21,7 +27,7 @@ matrix:
|
|||
- php: 5.2
|
||||
dist: precise
|
||||
- php: 7.2
|
||||
env: WP_VERSION=latest WP_MULTISITE=0 RUN_PHPCS=1
|
||||
env: WP_VERSION=latest WP_MULTISITE=0 RUN_PHPCS=1 RUN_E2E=1
|
||||
- php: 7.2
|
||||
env: WP_VERSION=latest WP_MULTISITE=0 RUN_CODE_COVERAGE=1
|
||||
allow_failures:
|
||||
|
@ -35,6 +41,7 @@ before_script:
|
|||
script:
|
||||
- bash tests/bin/phpunit.sh
|
||||
- bash tests/bin/phpcs.sh
|
||||
- bash tests/bin/run-e2e-CI.sh
|
||||
|
||||
after_script:
|
||||
- bash tests/bin/travis.sh after
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2135,7 +2135,6 @@ ul.wc_coupon_list_block {
|
|||
|
||||
.order-status {
|
||||
display: inline-flex;
|
||||
padding: 0px 1em;
|
||||
line-height: 2.5em;
|
||||
color: #777;
|
||||
background: #E5E5E5;
|
||||
|
@ -2144,6 +2143,7 @@ ul.wc_coupon_list_block {
|
|||
margin: -.25em 0;
|
||||
cursor: inherit !important;
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
|
||||
&.status-completed {
|
||||
background: #C8D7E1;
|
||||
|
@ -2169,6 +2169,12 @@ ul.wc_coupon_list_block {
|
|||
background: #eba3a3;
|
||||
color: #761919;
|
||||
}
|
||||
|
||||
> span {
|
||||
margin: 0 1em;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
|
||||
.wc-order-preview {
|
||||
|
@ -2270,7 +2276,7 @@ ul.wc_coupon_list_block {
|
|||
white-space: nowrap;
|
||||
}
|
||||
.wc-action-button {
|
||||
margin: -1px !important;
|
||||
margin: 0 0 0 -1px !important;
|
||||
border: 1px solid #ccc;
|
||||
padding: 1px 10px !important;
|
||||
border-radius: 0 !important;
|
||||
|
@ -2279,6 +2285,9 @@ ul.wc_coupon_list_block {
|
|||
height: auto;
|
||||
z-index: 1;
|
||||
position:relative;
|
||||
max-width: 175px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.wc-action-button:hover,
|
||||
.wc-action-button:focus {
|
||||
|
@ -2286,6 +2295,7 @@ ul.wc_coupon_list_block {
|
|||
z-index: 2;
|
||||
}
|
||||
.wc-action-button:first-child {
|
||||
margin-left: 0 !important;
|
||||
border-top-left-radius: 3px !important;
|
||||
border-bottom-left-radius: 3px !important;
|
||||
}
|
||||
|
@ -2391,14 +2401,6 @@ ul.order_notes {
|
|||
border-color: #efefef transparent;
|
||||
}
|
||||
}
|
||||
li.customer-note {
|
||||
.note_content {
|
||||
background: #a7cedc;
|
||||
}
|
||||
.note_content::after {
|
||||
border-color: #a7cedc transparent;
|
||||
}
|
||||
}
|
||||
li.system-note {
|
||||
.note_content {
|
||||
background: #d7cad2;
|
||||
|
@ -2407,6 +2409,14 @@ ul.order_notes {
|
|||
border-color: #d7cad2 transparent;
|
||||
}
|
||||
}
|
||||
li.customer-note {
|
||||
.note_content {
|
||||
background: #a7cedc;
|
||||
}
|
||||
.note_content::after {
|
||||
border-color: #a7cedc transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.add_note {
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -547,6 +547,10 @@ body {
|
|||
padding: 20px;
|
||||
|
||||
p {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -363,17 +363,18 @@ p.demo_store,
|
|||
width: 5px;
|
||||
height: 5px;
|
||||
content: ' ';
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
&::before {
|
||||
left: -6px;
|
||||
left: -5px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-width: 0 1px 1px 0;
|
||||
box-shadow: 2px 2px 0 $secondary;
|
||||
}
|
||||
|
||||
&::after {
|
||||
right: -6px;
|
||||
right: -5px;
|
||||
border-bottom-left-radius: 4px;
|
||||
border-width: 0 0 1px 1px;
|
||||
box-shadow: -2px 2px 0 $secondary;
|
||||
|
@ -476,7 +477,7 @@ p.demo_store,
|
|||
}
|
||||
|
||||
.group_table {
|
||||
td.label {
|
||||
td.woocommerce-grouped-product-list-item__label {
|
||||
padding-right: 1em;
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7,8 +7,8 @@ jQuery( function( $ ) {
|
|||
}
|
||||
|
||||
/* Storage Handling */
|
||||
var $supports_html5_storage;
|
||||
var cart_hash_key = wc_cart_fragments_params.ajax_url.toString() + '-wc_cart_hash';
|
||||
var $supports_html5_storage = true,
|
||||
cart_hash_key = wc_cart_fragments_params.cart_hash_key;
|
||||
|
||||
try {
|
||||
$supports_html5_storage = ( 'sessionStorage' in window && window.sessionStorage !== null );
|
||||
|
@ -74,7 +74,7 @@ jQuery( function( $ ) {
|
|||
refresh_cart_fragment();
|
||||
});
|
||||
|
||||
$( document.body ).on( 'added_to_cart', function( event, fragments, cart_hash ) {
|
||||
$( document.body ).on( 'added_to_cart removed_from_cart', function( event, fragments, cart_hash ) {
|
||||
var prev_cart_hash = sessionStorage.getItem( cart_hash_key );
|
||||
|
||||
if ( prev_cart_hash === null || prev_cart_hash === undefined || prev_cart_hash === '' ) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(e){function t(){o&&sessionStorage.setItem("wc_cart_created",(new Date).getTime())}function n(e){o&&(localStorage.setItem(a,e),sessionStorage.setItem(a,e))}function r(){e.ajax(s)}if("undefined"==typeof wc_cart_fragments_params)return!1;var o,a=wc_cart_fragments_params.ajax_url.toString()+"-wc_cart_hash";try{o="sessionStorage"in window&&null!==window.sessionStorage,window.sessionStorage.setItem("wc","test"),window.sessionStorage.removeItem("wc"),window.localStorage.setItem("wc","test"),window.localStorage.removeItem("wc")}catch(w){o=!1}var s={url:wc_cart_fragments_params.wc_ajax_url.toString().replace("%%endpoint%%","get_refreshed_fragments"),type:"POST",success:function(r){r&&r.fragments&&(e.each(r.fragments,function(t,n){e(t).replaceWith(n)}),o&&(sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(r.fragments)),n(r.cart_hash),r.cart_hash&&t()),e(document.body).trigger("wc_fragments_refreshed"))}};if(o){var i=null;e(document.body).on("wc_fragment_refresh updated_wc_div",function(){r()}),e(document.body).on("added_to_cart",function(e,r,o){var s=sessionStorage.getItem(a);null!==s&&s!==undefined&&""!==s||t(),sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(r)),n(o)}),e(document.body).on("wc_fragments_refreshed",function(){clearTimeout(i),i=setTimeout(r,864e5)}),e(window).on("storage onstorage",function(e){a===e.originalEvent.key&&localStorage.getItem(a)!==sessionStorage.getItem(a)&&r()}),e(window).on("pageshow",function(t){t.originalEvent.persisted&&(e(".widget_shopping_cart_content").empty(),e(document.body).trigger("wc_fragment_refresh"))});try{var c=e.parseJSON(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),_=sessionStorage.getItem(a),g=Cookies.get("woocommerce_cart_hash"),m=sessionStorage.getItem("wc_cart_created");if(null!==_&&_!==undefined&&""!==_||(_=""),null!==g&&g!==undefined&&""!==g||(g=""),_&&(null===m||m===undefined||""===m))throw"No cart_created";if(m){var d=1*m+864e5,f=(new Date).getTime();if(d<f)throw"Fragment expired";i=setTimeout(r,d-f)}if(!c||!c["div.widget_shopping_cart_content"]||_!==g)throw"No fragment";e.each(c,function(t,n){e(t).replaceWith(n)}),e(document.body).trigger("wc_fragments_loaded")}catch(w){r()}}else r();Cookies.get("woocommerce_items_in_cart")>0?e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show():e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").hide(),e(document.body).on("adding_to_cart",function(){e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show()})});
|
||||
jQuery(function(e){function t(){o&&sessionStorage.setItem("wc_cart_created",(new Date).getTime())}function n(e){o&&(localStorage.setItem(a,e),sessionStorage.setItem(a,e))}function r(){e.ajax(s)}if("undefined"==typeof wc_cart_fragments_params)return!1;var o=!0,a=wc_cart_fragments_params.cart_hash_key;try{o="sessionStorage"in window&&null!==window.sessionStorage,window.sessionStorage.setItem("wc","test"),window.sessionStorage.removeItem("wc"),window.localStorage.setItem("wc","test"),window.localStorage.removeItem("wc")}catch(w){o=!1}var s={url:wc_cart_fragments_params.wc_ajax_url.toString().replace("%%endpoint%%","get_refreshed_fragments"),type:"POST",success:function(r){r&&r.fragments&&(e.each(r.fragments,function(t,n){e(t).replaceWith(n)}),o&&(sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(r.fragments)),n(r.cart_hash),r.cart_hash&&t()),e(document.body).trigger("wc_fragments_refreshed"))}};if(o){var i=null;e(document.body).on("wc_fragment_refresh updated_wc_div",function(){r()}),e(document.body).on("added_to_cart",function(e,r,o){var s=sessionStorage.getItem(a);null!==s&&s!==undefined&&""!==s||t(),sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(r)),n(o)}),e(document.body).on("wc_fragments_refreshed",function(){clearTimeout(i),i=setTimeout(r,864e5)}),e(window).on("storage onstorage",function(e){a===e.originalEvent.key&&localStorage.getItem(a)!==sessionStorage.getItem(a)&&r()}),e(window).on("pageshow",function(t){t.originalEvent.persisted&&(e(".widget_shopping_cart_content").empty(),e(document.body).trigger("wc_fragment_refresh"))});try{var c=e.parseJSON(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),_=sessionStorage.getItem(a),g=Cookies.get("woocommerce_cart_hash"),m=sessionStorage.getItem("wc_cart_created");if(null!==_&&_!==undefined&&""!==_||(_=""),null!==g&&g!==undefined&&""!==g||(g=""),_&&(null===m||m===undefined||""===m))throw"No cart_created";if(m){var d=1*m+864e5,f=(new Date).getTime();if(d<f)throw"Fragment expired";i=setTimeout(r,d-f)}if(!c||!c["div.widget_shopping_cart_content"]||_!==g)throw"No fragment";e.each(c,function(t,n){e(t).replaceWith(n)}),e(document.body).trigger("wc_fragments_loaded")}catch(w){r()}}else r();Cookies.get("woocommerce_items_in_cart")>0?e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show():e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").hide(),e(document.body).on("adding_to_cart",function(){e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show()})});
|
|
@ -102,7 +102,7 @@ jQuery( function( $ ) {
|
|||
}
|
||||
|
||||
$( '.woocommerce-cart-form' ).replaceWith( $new_form );
|
||||
$( '.woocommerce-cart-form' ).find( 'input[name="update_cart"]' ).prop( 'disabled', true );
|
||||
$( '.woocommerce-cart-form' ).find( ':input[name="update_cart"]' ).prop( 'disabled', true );
|
||||
|
||||
if ( $notices.length > 0 ) {
|
||||
show_notice( $notices );
|
||||
|
@ -158,7 +158,7 @@ jQuery( function( $ ) {
|
|||
);
|
||||
$( document ).on(
|
||||
'change',
|
||||
'select.shipping_method, input[name^=shipping_method]',
|
||||
'select.shipping_method, :input[name^=shipping_method]',
|
||||
this.shipping_method_selected
|
||||
);
|
||||
$( document ).on(
|
||||
|
@ -185,7 +185,7 @@ jQuery( function( $ ) {
|
|||
shipping_method_selected: function() {
|
||||
var shipping_methods = {};
|
||||
|
||||
$( 'select.shipping_method, input[name^=shipping_method][type=radio]:checked, input[name^=shipping_method][type=hidden]' ).each( function() {
|
||||
$( 'select.shipping_method, :input[name^=shipping_method][type=radio]:checked, :input[name^=shipping_method][type=hidden]' ).each( function() {
|
||||
shipping_methods[ $( this ).data( 'index' ) ] = $( this ).val();
|
||||
} );
|
||||
|
||||
|
@ -271,11 +271,11 @@ jQuery( function( $ ) {
|
|||
function() { cart.update_cart.apply( cart, [].slice.call( arguments, 1 ) ); } );
|
||||
$( document ).on(
|
||||
'click',
|
||||
'.woocommerce-cart-form input[type=submit]',
|
||||
'.woocommerce-cart-form :input[type=submit]',
|
||||
this.submit_click );
|
||||
$( document ).on(
|
||||
'keypress',
|
||||
'.woocommerce-cart-form input[type=number]',
|
||||
'.woocommerce-cart-form :input[type=number]',
|
||||
this.input_keypress );
|
||||
$( document ).on(
|
||||
'submit',
|
||||
|
@ -298,14 +298,14 @@ jQuery( function( $ ) {
|
|||
'.woocommerce-cart-form .cart_item :input',
|
||||
this.input_changed );
|
||||
|
||||
$( '.woocommerce-cart-form input[name="update_cart"]' ).prop( 'disabled', true );
|
||||
$( '.woocommerce-cart-form :input[name="update_cart"]' ).prop( 'disabled', true );
|
||||
},
|
||||
|
||||
/**
|
||||
* After an input is changed, enable the update cart button.
|
||||
*/
|
||||
input_changed: function() {
|
||||
$( '.woocommerce-cart-form input[name="update_cart"]' ).prop( 'disabled', false );
|
||||
$( '.woocommerce-cart-form :input[name="update_cart"]' ).prop( 'disabled', false );
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -376,9 +376,9 @@ jQuery( function( $ ) {
|
|||
* @param {Object} evt The JQuery event
|
||||
*/
|
||||
cart_submit: function( evt ) {
|
||||
var $submit = $( document.activeElement );
|
||||
var $clicked = $( 'input[type=submit][clicked=true]' );
|
||||
var $form = $( evt.currentTarget );
|
||||
var $submit = $( document.activeElement ),
|
||||
$clicked = $( ':input[type=submit][clicked=true]' ),
|
||||
$form = $( evt.currentTarget );
|
||||
|
||||
// For submit events, currentTarget is form.
|
||||
// For keypress events, currentTarget is input.
|
||||
|
@ -394,11 +394,11 @@ jQuery( function( $ ) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( $clicked.is( 'input[name="update_cart"]' ) || $submit.is( 'input.qty' ) ) {
|
||||
if ( $clicked.is( ':input[name="update_cart"]' ) || $submit.is( 'input.qty' ) ) {
|
||||
evt.preventDefault();
|
||||
this.quantity_update( $form );
|
||||
|
||||
} else if ( $clicked.is( 'input[name="apply_coupon"]' ) || $submit.is( '#coupon_code' ) ) {
|
||||
} else if ( $clicked.is( ':input[name="apply_coupon"]' ) || $submit.is( '#coupon_code' ) ) {
|
||||
evt.preventDefault();
|
||||
this.apply_coupon( $form );
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ jQuery( function( $ ) {
|
|||
* @param {Object} evt The JQuery event
|
||||
*/
|
||||
submit_click: function( evt ) {
|
||||
$( 'input[type=submit]', $( evt.target ).parents( 'form' ) ).removeAttr( 'clicked' );
|
||||
$( ':input[type=submit]', $( evt.target ).parents( 'form' ) ).removeAttr( 'clicked' );
|
||||
$( evt.target ).attr( 'clicked', 'true' );
|
||||
},
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,7 @@
|
|||
"description": "An eCommerce toolkit that helps you sell anything. Beautifully.",
|
||||
"homepage": "https://woocommerce.com/",
|
||||
"type": "wordpress-plugin",
|
||||
"license": "GPL-2.0+",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"require": {
|
||||
"composer/installers": "~1.2"
|
||||
},
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
Type,SKU,Name,Published,Is featured?,Visibility in catalog,Short description,Description,Date sale price starts,Date sale price ends,Tax status,Tax class,In stock?,Stock,Backorders allowed?,Sold individually?,Weight (kg),Length (cm),Width (cm),Height (cm),Allow customer reviews?,Purchase note,Sale price,Regular price,Categories,Tags,Shipping class,Images,Download limit,Download expiry days,Parent,Grouped products,Upsells,Cross-sells,External URL,Button text,Position,Attribute 1 name,Attribute 1 value(s),Attribute 1 visible,Attribute 1 global,Attribute 2 name,Attribute 2 value(s),Attribute 2 visible,Attribute 2 global,Download 1 name,Download 1 URL,Download 2 name,Download 2 URL
|
||||
variable,woo-vneck-tee,V-Neck T-Shirt,1,1,visible,This is a variable product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,,,T-Shirts,,,"https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/vneck-tee.jpg, https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/vnech-tee-green.jpg, https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/vnech-tee-blue.jpg",,,,,,,,,0,Color,"Blue, Green, Red",1,1,Size,"Large, Medium, Small",1,1,,,,
|
||||
variable,woo-hoodie,Hoodie,1,0,visible,This is a variable product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,,,Hoodies,,,"https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/hoodie.jpg, https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/05/hoodie-blue.jpg, https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/05/hoodie-green.jpg, https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/hoodie-with-logo.jpg",,,,,,,,,0,Color,"Blue, Green, Red",1,1,Logo,"Yes, No",1,0,,,,
|
||||
simple,woo-beanie,Beanie,1,0,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,18,20,Accessories,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/beanie.jpg,,,,,,,,,0,Color,Red,1,1,,,,,,,,
|
||||
simple,woo-belt,Belt,1,0,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,55,65,Accessories,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/belt.jpg,,,,,,,,,0,,,,,,,,,,,,
|
||||
simple,woo-cap,Cap,1,1,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,16,18,Accessories,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/cap.jpg,,,,,,,,,0,Color,Yellow,1,1,,,,,,,,
|
||||
simple,woo-sunglasses,Sunglasses,1,1,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,,90,Accessories,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/sunglasses.jpg,,,,,,,,,0,,,,,,,,,,,,
|
||||
simple,woo-hoodie-with-logo,Hoodie with Logo,1,0,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,,45,Hoodies,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/hoodie-with-logo.jpg,,,,,,,,,0,Color,Blue,1,1,,,,,,,,
|
||||
simple,woo-hoodie-with-pocket,Hoodie with Pocket,1,1,hidden,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,35,45,Hoodies,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/hoodie-with-pocket.jpg,,,,,,,,,0,Color,Gray,1,1,,,,,,,,
|
||||
simple,woo-hoodie-with-zipper,Hoodie with Zipper,1,1,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,,45,Hoodies,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/hoodie-with-zipper.jpg,,,,,,,,,0,,,,,,,,,,,,
|
||||
simple,woo-long-sleeve-tee,Long Sleeve Tee,1,0,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,,25,T-Shirts,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/long-sleeve-tee.jpg,,,,,,,,,0,Color,Green,1,1,,,,,,,,
|
||||
simple,woo-polo,Polo,1,0,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,,20,T-Shirts,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/polo.jpg,,,,,,,,,0,Color,Blue,1,1,,,,,,,,
|
||||
simple,woo-tshirt,T-Shirt,1,0,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,,18,T-Shirts,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/tshirt.jpg,,,,,,,,,0,Color,Gray,1,1,,,,,,,,
|
||||
"simple, downloadable, virtual",woo-album,Album,1,0,visible,"This is a simple, virtual product.","Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,1,,,15,Music,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/album.jpg,1,1,,,,,,,0,,,,,,,,,Single 1,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/single.jpg,Single 2,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/album.jpg
|
||||
"simple, downloadable, virtual",woo-single,Single,1,0,visible,"This is a simple, virtual product.","Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,1,,2,3,Music,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/single.jpg,1,1,,,,,,,0,,,,,,,,,Single,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/single.jpg,,
|
||||
variation,woo-vneck-tee-red,V-Neck T-Shirt - Red,1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,0,,,20,,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/vneck-tee.jpg,,,woo-vneck-tee,,,,,,0,Color,Red,,1,Size,,,1,,,,
|
||||
variation,woo-vneck-tee-green,V-Neck T-Shirt - Green,1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,0,,,20,,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/vnech-tee-green.jpg,,,woo-vneck-tee,,,,,,0,Color,Green,,1,Size,,,1,,,,
|
||||
variation,woo-vneck-tee-blue,V-Neck T-Shirt - Blue,1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,0,,,15,,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/vnech-tee-blue.jpg,,,woo-vneck-tee,,,,,,0,Color,Blue,,1,Size,,,1,,,,
|
||||
variation,woo-hoodie-red,"Hoodie - Red, No",1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,0,,42,45,,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/hoodie.jpg,,,woo-hoodie,,,,,,1,Color,Red,,1,Logo,No,,0,,,,
|
||||
variation,woo-hoodie-green,"Hoodie - Green, No",1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,0,,,45,,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/05/hoodie-green.jpg,,,woo-hoodie,,,,,,2,Color,Green,,1,Logo,No,,0,,,,
|
||||
variation,woo-hoodie-blue,"Hoodie - Blue, No",1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,0,,,45,,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/05/hoodie-blue.jpg,,,woo-hoodie,,,,,,3,Color,Blue,,1,Logo,No,,0,,,,
|
||||
simple,Woo-tshirt-logo,T-Shirt with Logo,1,0,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,,18,T-Shirts,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/11/t-shirt-with-logo.jpg,,,,,,,,,0,Color,Gray,1,1,,,,,,,,
|
||||
simple,Woo-beanie-logo,Beanie with Logo,1,0,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,18,20,Accessories,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/11/beanie-with-logo.jpg,,,,,,,,,0,Color,Red,1,1,,,,,,,,
|
||||
grouped,logo-collection,Logo Collection,1,0,visible,This is a grouped product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,,,,,,"https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/11/logo.jpg, https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/11/beanie-with-logo.jpg, https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/11/t-shirt-with-logo.jpg, https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/hoodie-with-logo.jpg",,,,"woo-hoodie-with-logo, woo-tshirt, woo-beanie",,,,,0,,,,,,,,,,,,
|
||||
external,wp-pennant,WordPress Pennant,1,0,visible,This is an external product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,,11.05,Accessories,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/11/pennant.jpg,,,,,,,https://mercantile.wordpress.org/product/wordpress-pennant/,Buy on the WordPress swag store!,0,,,,,,,,,,,,
|
||||
variation,woo-hoodie-blue-logo,"Hoodie - Blue, Yes",1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,0,,,45,,,,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/hoodie-with-logo.jpg,,,woo-hoodie,,,,,,0,Color,Blue,,1,Logo,Yes,,0,,,,
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -6,6 +6,9 @@
|
|||
* @category i18n
|
||||
* @package WooCommerce/i18n
|
||||
* @version 2.0.0
|
||||
*
|
||||
* English notation of prefectures conform to the notation of Japan Post.
|
||||
* The suffix corresponds with the Japanese translation file.
|
||||
*/
|
||||
global $states;
|
||||
|
||||
|
@ -15,50 +18,50 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
|
||||
$states['JP'] = array(
|
||||
'JP01' => __( 'Hokkaido', 'woocommerce' ),
|
||||
'JP02' => __( 'Aomori-ken', 'woocommerce' ),
|
||||
'JP03' => __( 'Iwate-ken', 'woocommerce' ),
|
||||
'JP04' => __( 'Miyagi-ken', 'woocommerce' ),
|
||||
'JP05' => __( 'Akita-ken', 'woocommerce' ),
|
||||
'JP06' => __( 'Yamagata-ken', 'woocommerce' ),
|
||||
'JP07' => __( 'Fukushima-ken', 'woocommerce' ),
|
||||
'JP08' => __( 'Ibaraki-ken', 'woocommerce' ),
|
||||
'JP09' => __( 'Tochigi-ken', 'woocommerce' ),
|
||||
'JP10' => __( 'Gunma-ken', 'woocommerce' ),
|
||||
'JP11' => __( 'Saitama-ken', 'woocommerce' ),
|
||||
'JP12' => __( 'Chiba-ken', 'woocommerce' ),
|
||||
'JP13' => __( 'Tokyo-to', 'woocommerce' ),
|
||||
'JP14' => __( 'Kanagawa-ken', 'woocommerce' ),
|
||||
'JP15' => __( 'Niigata-ken', 'woocommerce' ),
|
||||
'JP16' => __( 'Toyama-ken', 'woocommerce' ),
|
||||
'JP17' => __( 'Ishikawa-ken', 'woocommerce' ),
|
||||
'JP18' => __( 'Fukui-ken', 'woocommerce' ),
|
||||
'JP19' => __( 'Yamanashi-ken', 'woocommerce' ),
|
||||
'JP20' => __( 'Nagano-ken', 'woocommerce' ),
|
||||
'JP21' => __( 'Gifu-ken', 'woocommerce' ),
|
||||
'JP22' => __( 'Shizuoka-ken', 'woocommerce' ),
|
||||
'JP23' => __( 'Aichi-ken', 'woocommerce' ),
|
||||
'JP24' => __( 'Mie-ken', 'woocommerce' ),
|
||||
'JP25' => __( 'Shiga-ken', 'woocommerce' ),
|
||||
'JP26' => __( 'Kyoto-fu', 'woocommerce' ),
|
||||
'JP27' => __( 'Osaka-fu', 'woocommerce' ),
|
||||
'JP28' => __( 'Hyogo-ken', 'woocommerce' ),
|
||||
'JP29' => __( 'Nara-ken', 'woocommerce' ),
|
||||
'JP30' => __( 'Wakayama-ken', 'woocommerce' ),
|
||||
'JP31' => __( 'Tottori-ken', 'woocommerce' ),
|
||||
'JP32' => __( 'Shimane-ken', 'woocommerce' ),
|
||||
'JP33' => __( 'Okayama-ken', 'woocommerce' ),
|
||||
'JP34' => __( 'Hiroshima-ken', 'woocommerce' ),
|
||||
'JP35' => __( 'Yamaguchi-ken', 'woocommerce' ),
|
||||
'JP36' => __( 'Tokushima-ken', 'woocommerce' ),
|
||||
'JP37' => __( 'Kagawa-ken', 'woocommerce' ),
|
||||
'JP38' => __( 'Ehime-ken', 'woocommerce' ),
|
||||
'JP39' => __( 'Kochi-ken', 'woocommerce' ),
|
||||
'JP40' => __( 'Fukuoka-ken', 'woocommerce' ),
|
||||
'JP41' => __( 'Saga-ken', 'woocommerce' ),
|
||||
'JP42' => __( 'Nagasaki-ken', 'woocommerce' ),
|
||||
'JP43' => __( 'Kumamoto-ken', 'woocommerce' ),
|
||||
'JP44' => __( 'Oita-ken', 'woocommerce' ),
|
||||
'JP45' => __( 'Miyazaki-ken', 'woocommerce' ),
|
||||
'JP46' => __( 'Kagoshima-ken', 'woocommerce' ),
|
||||
'JP47' => __( 'Okinawa-ken', 'woocommerce' ),
|
||||
'JP02' => __( 'Aomori', 'woocommerce' ),
|
||||
'JP03' => __( 'Iwate', 'woocommerce' ),
|
||||
'JP04' => __( 'Miyagi', 'woocommerce' ),
|
||||
'JP05' => __( 'Akita', 'woocommerce' ),
|
||||
'JP06' => __( 'Yamagata', 'woocommerce' ),
|
||||
'JP07' => __( 'Fukushima', 'woocommerce' ),
|
||||
'JP08' => __( 'Ibaraki', 'woocommerce' ),
|
||||
'JP09' => __( 'Tochigi', 'woocommerce' ),
|
||||
'JP10' => __( 'Gunma', 'woocommerce' ),
|
||||
'JP11' => __( 'Saitama', 'woocommerce' ),
|
||||
'JP12' => __( 'Chiba', 'woocommerce' ),
|
||||
'JP13' => __( 'Tokyo', 'woocommerce' ),
|
||||
'JP14' => __( 'Kanagawa', 'woocommerce' ),
|
||||
'JP15' => __( 'Niigata', 'woocommerce' ),
|
||||
'JP16' => __( 'Toyama', 'woocommerce' ),
|
||||
'JP17' => __( 'Ishikawa', 'woocommerce' ),
|
||||
'JP18' => __( 'Fukui', 'woocommerce' ),
|
||||
'JP19' => __( 'Yamanashi', 'woocommerce' ),
|
||||
'JP20' => __( 'Nagano', 'woocommerce' ),
|
||||
'JP21' => __( 'Gifu', 'woocommerce' ),
|
||||
'JP22' => __( 'Shizuoka', 'woocommerce' ),
|
||||
'JP23' => __( 'Aichi', 'woocommerce' ),
|
||||
'JP24' => __( 'Mie', 'woocommerce' ),
|
||||
'JP25' => __( 'Shiga', 'woocommerce' ),
|
||||
'JP26' => __( 'Kyoto', 'woocommerce' ),
|
||||
'JP27' => __( 'Osaka', 'woocommerce' ),
|
||||
'JP28' => __( 'Hyogo', 'woocommerce' ),
|
||||
'JP29' => __( 'Nara', 'woocommerce' ),
|
||||
'JP30' => __( 'Wakayama', 'woocommerce' ),
|
||||
'JP31' => __( 'Tottori', 'woocommerce' ),
|
||||
'JP32' => __( 'Shimane', 'woocommerce' ),
|
||||
'JP33' => __( 'Okayama', 'woocommerce' ),
|
||||
'JP34' => __( 'Hiroshima', 'woocommerce' ),
|
||||
'JP35' => __( 'Yamaguchi', 'woocommerce' ),
|
||||
'JP36' => __( 'Tokushima', 'woocommerce' ),
|
||||
'JP37' => __( 'Kagawa', 'woocommerce' ),
|
||||
'JP38' => __( 'Ehime', 'woocommerce' ),
|
||||
'JP39' => __( 'Kochi', 'woocommerce' ),
|
||||
'JP40' => __( 'Fukuoka', 'woocommerce' ),
|
||||
'JP41' => __( 'Saga', 'woocommerce' ),
|
||||
'JP42' => __( 'Nagasaki', 'woocommerce' ),
|
||||
'JP43' => __( 'Kumamoto', 'woocommerce' ),
|
||||
'JP44' => __( 'Oita', 'woocommerce' ),
|
||||
'JP45' => __( 'Miyazaki', 'woocommerce' ),
|
||||
'JP46' => __( 'Kagoshima', 'woocommerce' ),
|
||||
'JP47' => __( 'Okinawa', 'woocommerce' ),
|
||||
);
|
||||
|
|
|
@ -1437,6 +1437,9 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
$this->set_discount_total( $cart_subtotal - $cart_total );
|
||||
$this->set_discount_tax( $cart_subtotal_tax - $cart_total_tax );
|
||||
$this->set_total( round( $cart_total + $fee_total + $this->get_shipping_total() + $this->get_cart_tax() + $this->get_shipping_tax(), wc_get_price_decimals() ) );
|
||||
|
||||
do_action( 'woocommerce_order_after_calculate_totals', $and_taxes, $this );
|
||||
|
||||
$this->save();
|
||||
|
||||
return $this->get_total();
|
||||
|
|
|
@ -192,7 +192,15 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller {
|
|||
return $object;
|
||||
}
|
||||
|
||||
$this->update_additional_fields_for_object( $object, $request );
|
||||
try {
|
||||
$this->update_additional_fields_for_object( $object, $request );
|
||||
} catch ( WC_Data_Exception $e ) {
|
||||
$object->delete();
|
||||
return new WP_Error( $e->getErrorCode(), $e->getMessage(), $e->getErrorData() );
|
||||
} catch ( WC_REST_Exception $e ) {
|
||||
$object->delete();
|
||||
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires after a single object is created or updated via the REST API.
|
||||
|
@ -231,7 +239,13 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller {
|
|||
return $object;
|
||||
}
|
||||
|
||||
$this->update_additional_fields_for_object( $object, $request );
|
||||
try {
|
||||
$this->update_additional_fields_for_object( $object, $request );
|
||||
} catch ( WC_Data_Exception $e ) {
|
||||
return new WP_Error( $e->getErrorCode(), $e->getMessage(), $e->getErrorData() );
|
||||
} catch ( WC_REST_Exception $e ) {
|
||||
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires after a single object is created or updated via the REST API.
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* Abstract Rest Terms Controller
|
||||
*
|
||||
* @package WooCommerce/Abstracts
|
||||
* @version 3.3.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract Rest Terms Controller Class
|
||||
*
|
||||
* @author WooThemes
|
||||
* @category API
|
||||
* @package WooCommerce/Abstracts
|
||||
* @version 2.6.0
|
||||
* Terms controller class.
|
||||
*/
|
||||
abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
||||
|
||||
|
@ -32,73 +33,81 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
* Register the routes for terms.
|
||||
*/
|
||||
public function register_routes() {
|
||||
register_rest_route( $this->namespace, '/' . $this->rest_base, array(
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'callback' => array( $this, 'get_items' ),
|
||||
'permission_callback' => array( $this, 'get_items_permissions_check' ),
|
||||
'args' => $this->get_collection_params(),
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::CREATABLE,
|
||||
'callback' => array( $this, 'create_item' ),
|
||||
'permission_callback' => array( $this, 'create_item_permissions_check' ),
|
||||
'args' => array_merge( $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ), array(
|
||||
'name' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'Name for the resource.', 'woocommerce' ),
|
||||
'required' => true,
|
||||
),
|
||||
) ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
));
|
||||
|
||||
register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)', array(
|
||||
'args' => array(
|
||||
'id' => array(
|
||||
'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
register_rest_route(
|
||||
$this->namespace, '/' . $this->rest_base, array(
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'callback' => array( $this, 'get_items' ),
|
||||
'permission_callback' => array( $this, 'get_items_permissions_check' ),
|
||||
'args' => $this->get_collection_params(),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'callback' => array( $this, 'get_item' ),
|
||||
'permission_callback' => array( $this, 'get_item_permissions_check' ),
|
||||
'args' => array(
|
||||
'context' => $this->get_context_param( array( 'default' => 'view' ) ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'callback' => array( $this, 'update_item' ),
|
||||
'permission_callback' => array( $this, 'update_item_permissions_check' ),
|
||||
'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::DELETABLE,
|
||||
'callback' => array( $this, 'delete_item' ),
|
||||
'permission_callback' => array( $this, 'delete_item_permissions_check' ),
|
||||
'args' => array(
|
||||
'force' => array(
|
||||
'default' => false,
|
||||
'type' => 'boolean',
|
||||
'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ),
|
||||
array(
|
||||
'methods' => WP_REST_Server::CREATABLE,
|
||||
'callback' => array( $this, 'create_item' ),
|
||||
'permission_callback' => array( $this, 'create_item_permissions_check' ),
|
||||
'args' => array_merge(
|
||||
$this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ), array(
|
||||
'name' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'Name for the resource.', 'woocommerce' ),
|
||||
'required' => true,
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
) );
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
);
|
||||
|
||||
register_rest_route( $this->namespace, '/' . $this->rest_base . '/batch', array(
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'callback' => array( $this, 'batch_items' ),
|
||||
'permission_callback' => array( $this, 'batch_items_permissions_check' ),
|
||||
'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_batch_schema' ),
|
||||
) );
|
||||
register_rest_route(
|
||||
$this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)', array(
|
||||
'args' => array(
|
||||
'id' => array(
|
||||
'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'callback' => array( $this, 'get_item' ),
|
||||
'permission_callback' => array( $this, 'get_item_permissions_check' ),
|
||||
'args' => array(
|
||||
'context' => $this->get_context_param( array( 'default' => 'view' ) ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'callback' => array( $this, 'update_item' ),
|
||||
'permission_callback' => array( $this, 'update_item_permissions_check' ),
|
||||
'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::DELETABLE,
|
||||
'callback' => array( $this, 'delete_item' ),
|
||||
'permission_callback' => array( $this, 'delete_item_permissions_check' ),
|
||||
'args' => array(
|
||||
'force' => array(
|
||||
'default' => false,
|
||||
'type' => 'boolean',
|
||||
'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
$this->namespace, '/' . $this->rest_base . '/batch', array(
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'callback' => array( $this, 'batch_items' ),
|
||||
'permission_callback' => array( $this, 'batch_items_permissions_check' ),
|
||||
'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_batch_schema' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -219,21 +228,22 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
* Check permissions.
|
||||
*
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @param string $context Request context.
|
||||
* @param string $context Request context.
|
||||
* @return bool|WP_Error
|
||||
*/
|
||||
protected function check_permissions( $request, $context = 'read' ) {
|
||||
// Get taxonomy.
|
||||
$taxonomy = $this->get_taxonomy( $request );
|
||||
if ( ! $taxonomy ) {
|
||||
if ( ! $taxonomy || ! taxonomy_exists( $taxonomy ) ) {
|
||||
return new WP_Error( 'woocommerce_rest_taxonomy_invalid', __( 'Taxonomy does not exist.', 'woocommerce' ), array( 'status' => 404 ) );
|
||||
}
|
||||
|
||||
// Check permissions for a single term.
|
||||
if ( $id = intval( $request['id'] ) ) {
|
||||
$id = intval( $request['id'] );
|
||||
if ( $id ) {
|
||||
$term = get_term( $id, $taxonomy );
|
||||
|
||||
if ( ! $term || $term->taxonomy !== $taxonomy ) {
|
||||
if ( is_wp_error( $term ) || ! $term || $term->taxonomy !== $taxonomy ) {
|
||||
return new WP_Error( 'woocommerce_rest_term_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) );
|
||||
}
|
||||
|
||||
|
@ -266,7 +276,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
if ( ! empty( $request['offset'] ) ) {
|
||||
$prepared_args['offset'] = $request['offset'];
|
||||
} else {
|
||||
$prepared_args['offset'] = ( $request['page'] - 1 ) * $prepared_args['number'];
|
||||
$prepared_args['offset'] = ( $request['page'] - 1 ) * $prepared_args['number'];
|
||||
}
|
||||
|
||||
$taxonomy_obj = get_taxonomy( $taxonomy );
|
||||
|
@ -296,9 +306,9 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
*/
|
||||
$prepared_args = apply_filters( "woocommerce_rest_{$taxonomy}_query", $prepared_args, $request );
|
||||
|
||||
if ( ! empty( $prepared_args['product'] ) ) {
|
||||
if ( ! empty( $prepared_args['product'] ) ) {
|
||||
$query_result = $this->get_terms_for_product( $prepared_args, $request );
|
||||
$total_terms = $this->total_terms;
|
||||
$total_terms = $this->total_terms;
|
||||
} else {
|
||||
$query_result = get_terms( $taxonomy, $prepared_args );
|
||||
|
||||
|
@ -308,7 +318,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
$total_terms = wp_count_terms( $taxonomy, $count_args );
|
||||
|
||||
// Ensure we don't return results when offset is out of bounds.
|
||||
// See https://core.trac.wordpress.org/ticket/35935
|
||||
// See https://core.trac.wordpress.org/ticket/35935.
|
||||
if ( $prepared_args['offset'] >= $total_terms ) {
|
||||
$query_result = array();
|
||||
}
|
||||
|
@ -320,7 +330,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
}
|
||||
$response = array();
|
||||
foreach ( $query_result as $term ) {
|
||||
$data = $this->prepare_item_for_response( $term, $request );
|
||||
$data = $this->prepare_item_for_response( $term, $request );
|
||||
$response[] = $this->prepare_response_for_collection( $data );
|
||||
}
|
||||
|
||||
|
@ -328,7 +338,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
|
||||
// Store pagination values for headers then unset for count query.
|
||||
$per_page = (int) $prepared_args['number'];
|
||||
$page = ceil( ( ( (int) $prepared_args['offset'] ) / $per_page ) + 1 );
|
||||
$page = ceil( ( ( (int) $prepared_args['offset'] ) / $per_page ) + 1 );
|
||||
|
||||
$response->header( 'X-WP-Total', (int) $total_terms );
|
||||
$max_pages = ceil( $total_terms / $per_page );
|
||||
|
@ -392,7 +402,8 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
|
||||
// If we're going to inform the client that the term exists,
|
||||
// give them the identifier they can actually use.
|
||||
if ( $term_id = $term->get_error_data( 'term_exists' ) ) {
|
||||
$term_id = $term->get_error_data( 'term_exists' );
|
||||
if ( $term_id ) {
|
||||
$error_data['resource_id'] = $term_id;
|
||||
}
|
||||
|
||||
|
@ -567,7 +578,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
/**
|
||||
* Prepare links for the request.
|
||||
*
|
||||
* @param object $term Term object.
|
||||
* @param object $term Term object.
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @return array Links for the given term.
|
||||
*/
|
||||
|
@ -579,7 +590,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
}
|
||||
|
||||
$links = array(
|
||||
'self' => array(
|
||||
'self' => array(
|
||||
'href' => rest_url( trailingslashit( $base ) . $term->term_id ),
|
||||
),
|
||||
'collection' => array(
|
||||
|
@ -602,8 +613,8 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
/**
|
||||
* Update term meta fields.
|
||||
*
|
||||
* @param WP_Term $term
|
||||
* @param WP_REST_Request $request
|
||||
* @param WP_Term $term Term object.
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @return bool|WP_Error
|
||||
*/
|
||||
protected function update_term_meta_fields( $term, $request ) {
|
||||
|
@ -618,8 +629,8 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
* supported, notably `include`, `exclude`. In `self::get_items()` these
|
||||
* are instead treated as a full query.
|
||||
*
|
||||
* @param array $prepared_args Arguments for `get_terms()`.
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @param array $prepared_args Arguments for `get_terms()`.
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @return array List of term objects. (Total count in `$this->total_terms`).
|
||||
*/
|
||||
protected function get_terms_for_product( $prepared_args, $request ) {
|
||||
|
@ -633,16 +644,15 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
|
||||
// get_items() verifies that we don't have `include` set, and default.
|
||||
// ordering is by `name`.
|
||||
if ( ! in_array( $prepared_args['orderby'], array( 'name', 'none', 'include' ) ) ) {
|
||||
if ( ! in_array( $prepared_args['orderby'], array( 'name', 'none', 'include' ), true ) ) {
|
||||
switch ( $prepared_args['orderby'] ) {
|
||||
case 'id' :
|
||||
case 'id':
|
||||
$this->sort_column = 'term_id';
|
||||
break;
|
||||
|
||||
case 'slug' :
|
||||
case 'term_group' :
|
||||
case 'description' :
|
||||
case 'count' :
|
||||
case 'slug':
|
||||
case 'term_group':
|
||||
case 'description':
|
||||
case 'count':
|
||||
$this->sort_column = $prepared_args['orderby'];
|
||||
break;
|
||||
}
|
||||
|
@ -654,7 +664,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
|
||||
// Pagination.
|
||||
$this->total_terms = count( $query_result );
|
||||
$query_result = array_slice( $query_result, $prepared_args['offset'], $prepared_args['number'] );
|
||||
$query_result = array_slice( $query_result, $prepared_args['offset'], $prepared_args['number'] );
|
||||
|
||||
return $query_result;
|
||||
}
|
||||
|
@ -688,10 +698,10 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
public function get_collection_params() {
|
||||
$params = parent::get_collection_params();
|
||||
|
||||
if ( '' !== $this->taxonomy ) {
|
||||
if ( '' !== $this->taxonomy && taxonomy_exists( $this->taxonomy ) ) {
|
||||
$taxonomy = get_taxonomy( $this->taxonomy );
|
||||
} else {
|
||||
$taxonomy = new stdClass();
|
||||
$taxonomy = new stdClass();
|
||||
$taxonomy->hierarchical = true;
|
||||
}
|
||||
|
||||
|
@ -701,7 +711,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
'description' => __( 'Ensure result set excludes specific ids.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'integer',
|
||||
'type' => 'integer',
|
||||
),
|
||||
'default' => array(),
|
||||
'sanitize_callback' => 'wp_parse_id_list',
|
||||
|
@ -710,36 +720,36 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
'description' => __( 'Limit result set to specific ids.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'integer',
|
||||
'type' => 'integer',
|
||||
),
|
||||
'default' => array(),
|
||||
'sanitize_callback' => 'wp_parse_id_list',
|
||||
);
|
||||
if ( ! $taxonomy->hierarchical ) {
|
||||
$params['offset'] = array(
|
||||
'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'sanitize_callback' => 'absint',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'sanitize_callback' => 'absint',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
}
|
||||
$params['order'] = array(
|
||||
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'sanitize_key',
|
||||
'default' => 'asc',
|
||||
'enum' => array(
|
||||
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'sanitize_key',
|
||||
'default' => 'asc',
|
||||
'enum' => array(
|
||||
'asc',
|
||||
'desc',
|
||||
),
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
$params['orderby'] = array(
|
||||
'description' => __( 'Sort collection by resource attribute.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'sanitize_key',
|
||||
'default' => 'name',
|
||||
'enum' => array(
|
||||
'description' => __( 'Sort collection by resource attribute.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'sanitize_key',
|
||||
'default' => 'name',
|
||||
'enum' => array(
|
||||
'id',
|
||||
'include',
|
||||
'name',
|
||||
|
@ -748,32 +758,32 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
'description',
|
||||
'count',
|
||||
),
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
$params['hide_empty'] = array(
|
||||
'description' => __( 'Whether to hide resources not assigned to any products.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
'description' => __( 'Whether to hide resources not assigned to any products.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
if ( $taxonomy->hierarchical ) {
|
||||
$params['parent'] = array(
|
||||
'description' => __( 'Limit result set to resources assigned to a specific parent.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'sanitize_callback' => 'absint',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
'description' => __( 'Limit result set to resources assigned to a specific parent.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'sanitize_callback' => 'absint',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
}
|
||||
$params['product'] = array(
|
||||
'description' => __( 'Limit result set to resources assigned to a specific product.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'default' => null,
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
'description' => __( 'Limit result set to resources assigned to a specific product.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'default' => null,
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
$params['slug'] = array(
|
||||
'description' => __( 'Limit result set to resources with a specific slug.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
'description' => __( 'Limit result set to resources with a specific slug.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
return $params;
|
||||
|
|
|
@ -91,7 +91,7 @@ class WC_Admin_Help {
|
|||
'<p><a href="https://woocommerce.com/?utm_source=helptab&utm_medium=product&utm_content=about&utm_campaign=woocommerceplugin" target="_blank">' . __( 'About WooCommerce', 'woocommerce' ) . '</a></p>' .
|
||||
'<p><a href="https://wordpress.org/plugins/woocommerce/" target="_blank">' . __( 'WordPress.org project', 'woocommerce' ) . '</a></p>' .
|
||||
'<p><a href="https://github.com/woocommerce/woocommerce" target="_blank">' . __( 'Github project', 'woocommerce' ) . '</a></p>' .
|
||||
'<p><a href="https://woocommerce.com/product-category/themes/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=wcthemes&utm_campaign=woocommerceplugin" target="_blank">' . __( 'Official themes', 'woocommerce' ) . '</a></p>' .
|
||||
'<p><a href="https://woocommerce.com/storefront/?utm_source=helptab&utm_medium=product&utm_content=wcthemes&utm_campaign=woocommerceplugin" target="_blank">' . __( 'Official theme', 'woocommerce' ) . '</a></p>' .
|
||||
'<p><a href="https://woocommerce.com/product-category/woocommerce-extensions/?utm_source=helptab&utm_medium=product&utm_content=wcextensions&utm_campaign=woocommerceplugin" target="_blank">' . __( 'Official extensions', 'woocommerce' ) . '</a></p>'
|
||||
);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ class WC_Admin_Notices {
|
|||
'install' => 'install_notice',
|
||||
'update' => 'update_notice',
|
||||
'template_files' => 'template_file_check_notice',
|
||||
'theme_support' => 'theme_check_notice',
|
||||
'legacy_shipping' => 'legacy_shipping_notice',
|
||||
'no_shipping_methods' => 'no_shipping_methods_notice',
|
||||
'simplify_commerce' => 'simplify_commerce_notice',
|
||||
|
@ -79,10 +78,6 @@ class WC_Admin_Notices {
|
|||
* Reset notices for themes when switched or a new version of WC is installed.
|
||||
*/
|
||||
public static function reset_admin_notices() {
|
||||
if ( ! current_theme_supports( 'woocommerce' ) ) {
|
||||
self::add_notice( 'theme_support' );
|
||||
}
|
||||
|
||||
$simplify_options = get_option( 'woocommerce_simplify_commerce_settings', array() );
|
||||
$location = wc_get_base_location();
|
||||
|
||||
|
@ -133,7 +128,11 @@ class WC_Admin_Notices {
|
|||
}
|
||||
|
||||
$hide_notice = sanitize_text_field( $_GET['wc-hide-notice'] );
|
||||
|
||||
self::remove_notice( $hide_notice );
|
||||
|
||||
update_user_meta( get_current_user_id(), 'dismissed_' . $hide_notice . '_notice', true );
|
||||
|
||||
do_action( 'woocommerce_hide_' . $hide_notice . '_notice' );
|
||||
}
|
||||
}
|
||||
|
@ -214,12 +213,14 @@ class WC_Admin_Notices {
|
|||
|
||||
/**
|
||||
* Show the Theme Check notice.
|
||||
*
|
||||
* @todo Remove this next major release.
|
||||
*/
|
||||
public static function theme_check_notice() {
|
||||
wc_deprecated_function( 'WC_Admin_Notices::theme_check_notice', '3.3.0' );
|
||||
|
||||
if ( ! current_theme_supports( 'woocommerce' ) ) {
|
||||
include( 'views/html-notice-theme-support.php' );
|
||||
} else {
|
||||
self::remove_notice( 'theme_support' );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -507,7 +507,7 @@ class WC_Admin_Post_Types {
|
|||
|
||||
if ( ! empty( $_REQUEST['change_regular_price'] ) && isset( $_REQUEST['_regular_price'] ) ) { // WPCS: input var ok, sanitization ok.
|
||||
$change_regular_price = absint( $_REQUEST['change_regular_price'] ); // WPCS: input var ok, sanitization ok.
|
||||
$regular_price = wc_clean( wp_unslash( $_REQUEST['_regular_price'] ) ); // WPCS: input var ok, sanitization ok.
|
||||
$regular_price = wc_format_decimal( wc_clean( wp_unslash( $_REQUEST['_regular_price'] ) ) ); // WPCS: input var ok, sanitization ok.
|
||||
|
||||
switch ( $change_regular_price ) {
|
||||
case 1:
|
||||
|
@ -543,7 +543,7 @@ class WC_Admin_Post_Types {
|
|||
|
||||
if ( ! empty( $_REQUEST['change_sale_price'] ) && isset( $_REQUEST['_sale_price'] ) ) { // WPCS: input var ok, sanitization ok.
|
||||
$change_sale_price = absint( $_REQUEST['change_sale_price'] ); // WPCS: input var ok, sanitization ok.
|
||||
$sale_price = esc_attr( wp_unslash( $_REQUEST['_sale_price'] ) ); // WPCS: input var ok, sanitization ok.
|
||||
$sale_price = wc_format_decimal( wc_clean( wp_unslash( $_REQUEST['_sale_price'] ) ) ); // WPCS: input var ok, sanitization ok.
|
||||
|
||||
switch ( $change_sale_price ) {
|
||||
case 1:
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
*
|
||||
* Takes new users through some basic steps to setup their store.
|
||||
*
|
||||
* @author WooThemes
|
||||
* @category Admin
|
||||
* @package WooCommerce/Admin
|
||||
* @version 2.6.0
|
||||
*/
|
||||
|
@ -24,21 +22,21 @@ class WC_Admin_Setup_Wizard {
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
private $step = '';
|
||||
private $step = '';
|
||||
|
||||
/**
|
||||
* Steps for the setup wizard
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $steps = array();
|
||||
private $steps = array();
|
||||
|
||||
/**
|
||||
* Actions to be executed after the HTTP response has completed
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $deferred_actions = array();
|
||||
private $deferred_actions = array();
|
||||
|
||||
/**
|
||||
* Tweets user can optionally send after install
|
||||
|
@ -69,10 +67,28 @@ class WC_Admin_Setup_Wizard {
|
|||
|
||||
/**
|
||||
* The theme "extra" should only be shown if the current user can modify themes
|
||||
* and the store doesn't already have a WooCommerce compatible theme.
|
||||
* and the store doesn't already have a WooCommerce theme.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function should_show_theme_extra() {
|
||||
$is_default_theme = wc_is_active_theme( array(
|
||||
$support_woocommerce = current_theme_supports( 'woocommerce' ) && ! $this->is_default_theme();
|
||||
|
||||
return (
|
||||
current_user_can( 'install_themes' ) &&
|
||||
current_user_can( 'switch_themes' ) &&
|
||||
! is_multisite() &&
|
||||
! $support_woocommerce
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the user using a default WP theme?
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function is_default_theme() {
|
||||
return wc_is_active_theme( array(
|
||||
'twentyseventeen',
|
||||
'twentysixteen',
|
||||
'twentyfifteen',
|
||||
|
@ -82,14 +98,6 @@ class WC_Admin_Setup_Wizard {
|
|||
'twentytwelve',
|
||||
'twentyten',
|
||||
) );
|
||||
|
||||
$support_woocommerce = current_theme_supports( 'woocommerce' ) && ! $is_default_theme;
|
||||
return (
|
||||
current_user_can( 'install_themes' ) &&
|
||||
current_user_can( 'switch_themes' ) &&
|
||||
! is_multisite() &&
|
||||
! $support_woocommerce
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,14 +116,14 @@ class WC_Admin_Setup_Wizard {
|
|||
WC()->countries->get_european_union_countries()
|
||||
);
|
||||
|
||||
return in_array( $country_code, $tax_supported_countries );
|
||||
return in_array( $country_code, $tax_supported_countries, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the setup wizard.
|
||||
*/
|
||||
public function setup_wizard() {
|
||||
if ( empty( $_GET['page'] ) || 'wc-setup' !== $_GET['page'] ) {
|
||||
if ( empty( $_GET['page'] ) || 'wc-setup' !== $_GET['page'] ) { // WPCS: CSRF ok, input var ok.
|
||||
return;
|
||||
}
|
||||
$default_steps = array(
|
||||
|
@ -124,27 +132,27 @@ class WC_Admin_Setup_Wizard {
|
|||
'view' => array( $this, 'wc_setup_store_setup' ),
|
||||
'handler' => array( $this, 'wc_setup_store_setup_save' ),
|
||||
),
|
||||
'payment' => array(
|
||||
'payment' => array(
|
||||
'name' => __( 'Payment', 'woocommerce' ),
|
||||
'view' => array( $this, 'wc_setup_payment' ),
|
||||
'handler' => array( $this, 'wc_setup_payment_save' ),
|
||||
),
|
||||
'shipping' => array(
|
||||
'shipping' => array(
|
||||
'name' => __( 'Shipping', 'woocommerce' ),
|
||||
'view' => array( $this, 'wc_setup_shipping' ),
|
||||
'handler' => array( $this, 'wc_setup_shipping_save' ),
|
||||
),
|
||||
'extras' => array(
|
||||
'extras' => array(
|
||||
'name' => __( 'Extras', 'woocommerce' ),
|
||||
'view' => array( $this, 'wc_setup_extras' ),
|
||||
'handler' => array( $this, 'wc_setup_extras_save' ),
|
||||
),
|
||||
'activate' => array(
|
||||
'activate' => array(
|
||||
'name' => __( 'Activate', 'woocommerce' ),
|
||||
'view' => array( $this, 'wc_setup_activate' ),
|
||||
'handler' => array( $this, 'wc_setup_activate_save' ),
|
||||
),
|
||||
'next_steps' => array(
|
||||
'next_steps' => array(
|
||||
'name' => __( 'Ready!', 'woocommerce' ),
|
||||
'view' => array( $this, 'wc_setup_ready' ),
|
||||
'handler' => '',
|
||||
|
@ -163,12 +171,7 @@ class WC_Admin_Setup_Wizard {
|
|||
|
||||
// Hide the activate step if Jetpack is already active, but not
|
||||
// if we're returning from connecting Jetpack on WordPress.com.
|
||||
if (
|
||||
class_exists( 'Jetpack' ) &&
|
||||
Jetpack::is_active() &&
|
||||
! isset( $_GET['from'] ) &&
|
||||
! isset( $_GET['activate_error'] )
|
||||
) {
|
||||
if ( class_exists( 'Jetpack' ) && Jetpack::is_active() && ! isset( $_GET['from'] ) && ! isset( $_GET['activate_error'] ) ) { // WPCS: CSRF ok, input var ok.
|
||||
unset( $default_steps['activate'] );
|
||||
}
|
||||
|
||||
|
@ -176,8 +179,8 @@ class WC_Admin_Setup_Wizard {
|
|||
$pending_jetpack = ! class_exists( 'Jetpack' ) && get_option( 'woocommerce_setup_background_installing_jetpack' );
|
||||
|
||||
$this->steps = apply_filters( 'woocommerce_setup_wizard_steps', $default_steps );
|
||||
$this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
|
||||
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
||||
$this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) ); // WPCS: CSRF ok, input var ok.
|
||||
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
||||
|
||||
wp_register_script( 'jquery-blockui', WC()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array( 'jquery' ), '2.70', true );
|
||||
wp_register_script( 'selectWoo', WC()->plugin_url() . '/assets/js/selectWoo/selectWoo.full' . $suffix . '.js', array( 'jquery' ), '1.0.0' );
|
||||
|
@ -238,7 +241,7 @@ class WC_Admin_Setup_Wizard {
|
|||
return admin_url();
|
||||
}
|
||||
|
||||
$step_index = array_search( $step, $keys );
|
||||
$step_index = array_search( $step, $keys, true );
|
||||
if ( false === $step_index ) {
|
||||
return '';
|
||||
}
|
||||
|
@ -275,7 +278,7 @@ class WC_Admin_Setup_Wizard {
|
|||
<a class="wc-return-to-dashboard" href="<?php echo esc_url( admin_url() ); ?>"><?php esc_html_e( 'Not right now', 'woocommerce' ); ?></a>
|
||||
<?php elseif ( 'next_steps' === $this->step ) : ?>
|
||||
<a class="wc-return-to-dashboard" href="<?php echo esc_url( admin_url() ); ?>"><?php esc_html_e( 'Return to your dashboard', 'woocommerce' ); ?></a>
|
||||
<?php elseif ( 'activate' === $this->step ) : ?>
|
||||
<?php elseif ( 'activate' === $this->step || 'extras' === $this->step ) : ?>
|
||||
<a class="wc-return-to-dashboard" href="<?php echo esc_url( $this->get_next_step_link() ); ?>"><?php esc_html_e( 'Skip this step', 'woocommerce' ); ?></a>
|
||||
<?php endif; ?>
|
||||
</body>
|
||||
|
@ -295,7 +298,7 @@ class WC_Admin_Setup_Wizard {
|
|||
<?php
|
||||
if ( $step_key === $this->step ) {
|
||||
echo 'active';
|
||||
} elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) {
|
||||
} elseif ( array_search( $this->step, array_keys( $this->steps ), true ) > array_search( $step_key, array_keys( $this->steps ), true ) ) {
|
||||
echo 'done';
|
||||
}
|
||||
?>
|
||||
|
@ -339,9 +342,8 @@ class WC_Admin_Setup_Wizard {
|
|||
$state = '*';
|
||||
}
|
||||
|
||||
$locale_info = include( WC()->plugin_path() . '/i18n/locale-info.php' );
|
||||
$locale_info = include WC()->plugin_path() . '/i18n/locale-info.php';
|
||||
$currency_by_country = wp_list_pluck( $locale_info, 'currency_code' );
|
||||
|
||||
?>
|
||||
<form method="post" class="address-step">
|
||||
<?php wp_nonce_field( 'wc-setup' ); ?>
|
||||
|
@ -354,7 +356,7 @@ class WC_Admin_Setup_Wizard {
|
|||
name="store_country_state"
|
||||
required
|
||||
data-placeholder="<?php esc_attr_e( 'Choose a country…', 'woocommerce' ); ?>"
|
||||
aria-label="<?php esc_attr_e( 'Country', 'woocommerce' ) ?>"
|
||||
aria-label="<?php esc_attr_e( 'Country', 'woocommerce' ); ?>"
|
||||
class="location-input wc-enhanced-select dropdown"
|
||||
>
|
||||
<?php WC()->countries->country_dropdown_options( $country, $state ); ?>
|
||||
|
@ -434,7 +436,7 @@ class WC_Admin_Setup_Wizard {
|
|||
<?php endforeach; ?>
|
||||
</select>
|
||||
<script type="text/javascript">
|
||||
var wc_setup_currencies = <?php echo json_encode( $currency_by_country ); ?>;
|
||||
var wc_setup_currencies = <?php echo wp_json_encode( $currency_by_country ); ?>;
|
||||
</script>
|
||||
|
||||
<label class="location-prompt" for="product_type">
|
||||
|
@ -500,7 +502,7 @@ class WC_Admin_Setup_Wizard {
|
|||
update_option( 'woocommerce_product_type', $product_type );
|
||||
update_option( 'woocommerce_sell_in_person', $sell_in_person );
|
||||
|
||||
$locale_info = include( WC()->plugin_path() . '/i18n/locale-info.php' );
|
||||
$locale_info = include WC()->plugin_path() . '/i18n/locale-info.php';
|
||||
$country = WC()->countries->get_base_country();
|
||||
|
||||
// Set currency formatting options based on chosen location and currency.
|
||||
|
@ -522,7 +524,7 @@ class WC_Admin_Setup_Wizard {
|
|||
}
|
||||
|
||||
WC_Install::create_pages();
|
||||
wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
|
||||
wp_safe_redirect( esc_url_raw( $this->get_next_step_link() ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -549,7 +551,7 @@ class WC_Admin_Setup_Wizard {
|
|||
if ( ! headers_sent() ) {
|
||||
header( 'Connection: close' );
|
||||
}
|
||||
@ob_end_flush();
|
||||
@ob_end_flush(); // @codingStandardsIgnoreLine.
|
||||
flush();
|
||||
}
|
||||
}
|
||||
|
@ -673,11 +675,11 @@ class WC_Admin_Setup_Wizard {
|
|||
*/
|
||||
protected function get_wizard_shipping_methods( $country_code, $currency_code ) {
|
||||
$shipping_methods = array(
|
||||
'live_rates' => array(
|
||||
'live_rates' => array(
|
||||
'name' => __( 'Live Rates', 'woocommerce' ),
|
||||
'description' => __( 'WooCommerce Services and Jetpack will be installed and activated for you.', 'woocommerce' ),
|
||||
),
|
||||
'flat_rate' => array(
|
||||
'flat_rate' => array(
|
||||
'name' => __( 'Flat Rate', 'woocommerce' ),
|
||||
'description' => __( 'Set a fixed price to cover shipping costs.', 'woocommerce' ),
|
||||
'settings' => array(
|
||||
|
@ -728,7 +730,7 @@ class WC_Admin_Setup_Wizard {
|
|||
</div>
|
||||
<div class="shipping-method-descriptions">
|
||||
<?php foreach ( $shipping_methods as $method_id => $method ) : ?>
|
||||
<p class="shipping-method-description <?php echo esc_attr( $method_id ); ?> <?php if ( $method_id !== $selected ) { echo 'hide'; } ?>">
|
||||
<p class="shipping-method-description <?php echo esc_attr( $method_id ); ?> <?php echo $method_id !== $selected ? 'hide' : ''; ?>">
|
||||
<?php echo esc_html( $method['description'] ); ?>
|
||||
</p>
|
||||
<?php endforeach; ?>
|
||||
|
@ -737,8 +739,12 @@ class WC_Admin_Setup_Wizard {
|
|||
|
||||
<div class="shipping-method-settings">
|
||||
<?php foreach ( $shipping_methods as $method_id => $method ) : ?>
|
||||
<?php if ( empty( $method['settings'] ) ) { continue; } ?>
|
||||
<div class="shipping-method-setting <?php echo esc_attr( $method_id ); ?> <?php if ( $method_id !== $selected ) { echo 'hide'; } ?>">
|
||||
<?php
|
||||
if ( empty( $method['settings'] ) ) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<div class="shipping-method-setting <?php echo esc_attr( $method_id ); ?> <?php echo $method_id !== $selected ? 'hide' : ''; ?>">
|
||||
<?php foreach ( $method['settings'] as $setting_id => $setting ) : ?>
|
||||
<?php $method_setting_id = "{$input_prefix}[{$method_id}][{$setting_id}]"; ?>
|
||||
<input
|
||||
|
@ -770,7 +776,7 @@ class WC_Admin_Setup_Wizard {
|
|||
$wcs_carrier = $this->get_wcs_shipping_carrier( $country_code, $currency_code );
|
||||
$existing_zones = WC_Shipping_Zones::get_zones();
|
||||
|
||||
$locale_info = include( WC()->plugin_path() . '/i18n/locale-info.php' );
|
||||
$locale_info = include WC()->plugin_path() . '/i18n/locale-info.php';
|
||||
if ( isset( $locale_info[ $country_code ] ) ) {
|
||||
$dimension_unit = $locale_info[ $country_code ]['dimension_unit'];
|
||||
$weight_unit = $locale_info[ $country_code ]['weight_unit'];
|
||||
|
@ -782,15 +788,15 @@ class WC_Admin_Setup_Wizard {
|
|||
if ( ! empty( $existing_zones ) ) {
|
||||
$intro_text = __( 'How would you like units on your store displayed?', 'woocommerce' );
|
||||
} elseif ( $wcs_carrier ) {
|
||||
/* translators: %1$s: country name including the 'the' prefix, %2$s: shipping carrier name */
|
||||
$intro_text = sprintf(
|
||||
/* translators: %1$s: country name including the 'the' prefix, %2$s: shipping carrier name */
|
||||
__( "You're all set up to ship anywhere in %1\$s, and outside of it. We recommend using <strong>live rates</strong> (which are powered by our WooCommerce Services plugin and Jetpack) to get accurate %2\$s shipping prices to cover the cost of order fulfillment.", 'woocommerce' ),
|
||||
$prefixed_country_name,
|
||||
$wcs_carrier
|
||||
);
|
||||
} else {
|
||||
/* translators: %s: country name including the 'the' prefix if needed */
|
||||
$intro_text = sprintf(
|
||||
/* translators: %s: country name including the 'the' prefix if needed */
|
||||
__( "You can choose which countries you'll be shipping to and with which methods. To get started, we've set you up with shipping inside and outside of %s.", 'woocommerce' ),
|
||||
$prefixed_country_name
|
||||
);
|
||||
|
@ -916,7 +922,7 @@ class WC_Admin_Setup_Wizard {
|
|||
|
||||
// For now, limit this setup to the first run.
|
||||
if ( ! empty( $existing_zones ) ) {
|
||||
wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
|
||||
wp_safe_redirect( esc_url_raw( $this->get_next_step_link() ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -933,7 +939,7 @@ class WC_Admin_Setup_Wizard {
|
|||
* store is located in, with the selected method preconfigured.
|
||||
*/
|
||||
if ( $setup_domestic ) {
|
||||
$country = WC()->countries->get_base_country();
|
||||
$country = WC()->countries->get_base_country();
|
||||
|
||||
$zone = new WC_Shipping_Zone( null );
|
||||
$zone->set_zone_order( 0 );
|
||||
|
@ -949,7 +955,7 @@ class WC_Admin_Setup_Wizard {
|
|||
$zone->save();
|
||||
|
||||
// Save chosen shipping method settings (using REST controller for convenience).
|
||||
if ( isset( $instance_id ) && ! empty( $_POST['shipping_zones']['domestic'][ $domestic_method ] ) ) {
|
||||
if ( isset( $instance_id ) && ! empty( $_POST['shipping_zones']['domestic'][ $domestic_method ] ) ) { // WPCS: input var ok.
|
||||
$method_controller = new WC_REST_Shipping_Zone_Methods_Controller();
|
||||
// @codingStandardsIgnoreStart
|
||||
$method_controller->update_item( array(
|
||||
|
@ -974,7 +980,7 @@ class WC_Admin_Setup_Wizard {
|
|||
}
|
||||
|
||||
// Save chosen shipping method settings (using REST controller for convenience).
|
||||
if ( isset( $instance_id ) && ! empty( $_POST['shipping_zones']['intl'][ $intl_method ] ) ) {
|
||||
if ( isset( $instance_id ) && ! empty( $_POST['shipping_zones']['intl'][ $intl_method ] ) ) { // WPCS: input var ok.
|
||||
$method_controller = new WC_REST_Shipping_Zone_Methods_Controller();
|
||||
// @codingStandardsIgnoreStart
|
||||
$method_controller->update_item( array(
|
||||
|
@ -991,7 +997,7 @@ class WC_Admin_Setup_Wizard {
|
|||
WC_Admin_Notices::add_notice( 'no_shipping_methods' );
|
||||
}
|
||||
|
||||
wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
|
||||
wp_safe_redirect( esc_url_raw( $this->get_next_step_link() ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -1026,7 +1032,7 @@ class WC_Admin_Setup_Wizard {
|
|||
'US',
|
||||
);
|
||||
|
||||
return in_array( $country_code, $stripe_supported_countries );
|
||||
return in_array( $country_code, $stripe_supported_countries, true );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1036,10 +1042,10 @@ class WC_Admin_Setup_Wizard {
|
|||
*/
|
||||
protected function is_klarna_checkout_supported_country( $country_code ) {
|
||||
$supported_countries = array(
|
||||
'SE', //Sweden
|
||||
'FI', //Finland
|
||||
'NO', //Norway
|
||||
'NL', //Netherlands
|
||||
'SE', // Sweden.
|
||||
'FI', // Finland.
|
||||
'NO', // Norway.
|
||||
'NL', // Netherlands.
|
||||
);
|
||||
return in_array( $country_code, $supported_countries, true );
|
||||
}
|
||||
|
@ -1051,9 +1057,9 @@ class WC_Admin_Setup_Wizard {
|
|||
*/
|
||||
protected function is_klarna_payments_supported_country( $country_code ) {
|
||||
$supported_countries = array(
|
||||
'DK', //Denmark
|
||||
'DE', //Germany
|
||||
'AT', //Austria
|
||||
'DK', // Denmark.
|
||||
'DE', // Germany.
|
||||
'AT', // Austria.
|
||||
);
|
||||
return in_array( $country_code, $supported_countries, true );
|
||||
}
|
||||
|
@ -1095,28 +1101,33 @@ class WC_Admin_Setup_Wizard {
|
|||
$user_email = $this->get_current_user_email();
|
||||
|
||||
$stripe_description = '<p>' . sprintf(
|
||||
/* translators: %s: URL */
|
||||
__( 'Accept debit and credit cards in 135+ currencies, methods such as Alipay, and one-touch checkout with Apple Pay. <a href="%s" target="_blank">Learn more</a>.', 'woocommerce' ),
|
||||
'https://woocommerce.com/products/stripe/'
|
||||
) . '</p>';
|
||||
$paypal_ec_description = '<p>' . sprintf(
|
||||
/* translators: %s: URL */
|
||||
__( 'Safe and secure payments using credit cards or your customer\'s PayPal account. <a href="%s" target="_blank">Learn more</a>.', 'woocommerce' ),
|
||||
'https://wordpress.org/plugins/woocommerce-gateway-paypal-express-checkout/'
|
||||
) . '</p>';
|
||||
$klarna_checkout_description = '<p>' . sprintf(
|
||||
__( 'Pay now, pay later, slice it. No credit card numbers, no passwords, no worries. <a href="%s" target="_blank">Learn more about Klarna</a>.', 'woocommerce' ),
|
||||
/* translators: %s: URL */
|
||||
__( 'Full checkout experience with pay now, pay later and slice it. No credit card numbers, no passwords, no worries. <a href="%s" target="_blank">Learn more about Klarna</a>.', 'woocommerce' ),
|
||||
'https://woocommerce.com/products/klarna/'
|
||||
) . '</p>';
|
||||
$klarna_payments_description = '<p>' . sprintf(
|
||||
__( 'Pay later, slice it. No credit card numbers, no passwords, no worries. <a href="%s" target="_blank">Learn more about Klarna</a>.', 'woocommerce' ),
|
||||
/* translators: %s: URL */
|
||||
__( 'Choose the payment that you want, pay now, pay later or slice it. No credit card numbers, no passwords, no worries. <a href="%s" target="_blank">Learn more about Klarna</a>.', 'woocommerce' ),
|
||||
'https://woocommerce.com/products/klarna/'
|
||||
) . '</p>';
|
||||
$square_description = '<p>' . sprintf(
|
||||
/* translators: %s: URL */
|
||||
__( 'Securely accept credit and debit cards with one low rate, no surprise fees (custom rates available). Sell online and in store and track sales and inventory in one place. <a href="%s" target="_blank">Learn more about Square</a>.', 'woocommerce' ),
|
||||
'https://woocommerce.com/products/square/'
|
||||
) . '</p>';
|
||||
|
||||
return array(
|
||||
'stripe' => array(
|
||||
'stripe' => array(
|
||||
'name' => __( 'Stripe', 'woocommerce' ),
|
||||
'image' => WC()->plugin_url() . '/assets/images/stripe.png',
|
||||
'description' => $stripe_description,
|
||||
|
@ -1130,7 +1141,7 @@ class WC_Admin_Setup_Wizard {
|
|||
'placeholder' => '',
|
||||
'required' => false,
|
||||
),
|
||||
'email' => array(
|
||||
'email' => array(
|
||||
'label' => __( 'Stripe email address:', 'woocommerce' ),
|
||||
'type' => 'email',
|
||||
'value' => $user_email,
|
||||
|
@ -1140,7 +1151,7 @@ class WC_Admin_Setup_Wizard {
|
|||
),
|
||||
),
|
||||
),
|
||||
'ppec_paypal' => array(
|
||||
'ppec_paypal' => array(
|
||||
'name' => __( 'PayPal Express Checkout', 'woocommerce' ),
|
||||
'image' => WC()->plugin_url() . '/assets/images/paypal.png',
|
||||
'description' => $paypal_ec_description,
|
||||
|
@ -1155,7 +1166,7 @@ class WC_Admin_Setup_Wizard {
|
|||
'placeholder' => '',
|
||||
'required' => false,
|
||||
),
|
||||
'email' => array(
|
||||
'email' => array(
|
||||
'label' => __( 'Direct payments to email address:', 'woocommerce' ),
|
||||
'type' => 'email',
|
||||
'value' => $user_email,
|
||||
|
@ -1165,7 +1176,7 @@ class WC_Admin_Setup_Wizard {
|
|||
),
|
||||
),
|
||||
),
|
||||
'paypal' => array(
|
||||
'paypal' => array(
|
||||
'name' => __( 'PayPal Standard', 'woocommerce' ),
|
||||
'description' => __( 'Accept payments via PayPal using account balance or credit card.', 'woocommerce' ),
|
||||
'image' => '',
|
||||
|
@ -1195,7 +1206,7 @@ class WC_Admin_Setup_Wizard {
|
|||
'class' => 'klarna-logo',
|
||||
'repo-slug' => 'klarna-payments-for-woocommerce',
|
||||
),
|
||||
'square' => array(
|
||||
'square' => array(
|
||||
'name' => __( 'Square', 'woocommerce' ),
|
||||
'description' => $square_description,
|
||||
'image' => WC()->plugin_url() . '/assets/images/square-white.png',
|
||||
|
@ -1242,9 +1253,9 @@ class WC_Admin_Setup_Wizard {
|
|||
|
||||
$offered_gateways = array();
|
||||
if ( $can_stripe ) {
|
||||
$gateways['stripe']['enabled'] = true;
|
||||
$gateways['stripe']['enabled'] = true;
|
||||
$gateways['stripe']['featured'] = true;
|
||||
$offered_gateways += array( 'stripe' => $gateways['stripe'] );
|
||||
$offered_gateways += array( 'stripe' => $gateways['stripe'] );
|
||||
}
|
||||
$offered_gateways += array( 'ppec_paypal' => $gateways['ppec_paypal'] );
|
||||
return $offered_gateways;
|
||||
|
@ -1263,13 +1274,13 @@ class WC_Admin_Setup_Wizard {
|
|||
'image' => '',
|
||||
'class' => '',
|
||||
),
|
||||
'bacs' => array(
|
||||
'bacs' => array(
|
||||
'name' => __( 'Bank transfer (BACS) payments', 'woocommerce' ),
|
||||
'description' => __( 'A simple offline gateway that lets you accept BACS payment.', 'woocommerce' ),
|
||||
'image' => '',
|
||||
'class' => '',
|
||||
),
|
||||
'cod' => array(
|
||||
'cod' => array(
|
||||
'name' => __( 'Cash on delivery', 'woocommerce' ),
|
||||
'description' => __( 'A simple offline gateway that lets you accept cash on delivery.', 'woocommerce' ),
|
||||
'image' => '',
|
||||
|
@ -1403,31 +1414,38 @@ class WC_Admin_Setup_Wizard {
|
|||
<h1><?php esc_html_e( 'Payment', 'woocommerce' ); ?></h1>
|
||||
<form method="post" class="wc-wizard-payment-gateway-form">
|
||||
<p>
|
||||
<?php printf(
|
||||
<?php
|
||||
printf(
|
||||
wp_kses(
|
||||
__( 'WooCommerce can accept both online and offline payments. <a href="%1$s" target="_blank">Additional payment methods</a> can be installed later.', 'woocommerce' ),
|
||||
/* translators: %s: Link */
|
||||
__( 'WooCommerce can accept both online and offline payments. <a href="%s" target="_blank">Additional payment methods</a> can be installed later.', 'woocommerce' ),
|
||||
array(
|
||||
'a' => array(
|
||||
'href' => array(),
|
||||
'href' => array(),
|
||||
'target' => array(),
|
||||
),
|
||||
)
|
||||
),
|
||||
esc_url( admin_url( 'admin.php?page=wc-addons&view=payment_gateways' ) )
|
||||
); ?>
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<?php if ( $featured_gateways ) : ?>
|
||||
<ul class="wc-wizard-services featured">
|
||||
<?php foreach ( $featured_gateways as $gateway_id => $gateway ) :
|
||||
<?php
|
||||
foreach ( $featured_gateways as $gateway_id => $gateway ) {
|
||||
$this->display_service_item( $gateway_id, $gateway );
|
||||
endforeach; ?>
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<?php if ( $in_cart_gateways ) : ?>
|
||||
<ul class="wc-wizard-services in-cart">
|
||||
<?php foreach ( $in_cart_gateways as $gateway_id => $gateway ) :
|
||||
<?php
|
||||
foreach ( $in_cart_gateways as $gateway_id => $gateway ) {
|
||||
$this->display_service_item( $gateway_id, $gateway );
|
||||
endforeach; ?>
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<ul class="wc-wizard-services manual">
|
||||
|
@ -1443,9 +1461,11 @@ class WC_Admin_Setup_Wizard {
|
|||
<label for="wc-wizard-service-list-toggle"></label>
|
||||
</div>
|
||||
</li>
|
||||
<?php foreach ( $manual_gateways as $gateway_id => $gateway ) :
|
||||
<?php
|
||||
foreach ( $manual_gateways as $gateway_id => $gateway ) {
|
||||
$this->display_service_item( $gateway_id, $gateway );
|
||||
endforeach; ?>
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<p class="wc-setup-actions step">
|
||||
<button type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
|
||||
|
@ -1464,12 +1484,12 @@ class WC_Admin_Setup_Wizard {
|
|||
if (
|
||||
(
|
||||
// Install WooCommerce Services with Stripe to enable deferred account creation.
|
||||
! empty( $_POST['wc-wizard-service-stripe-enabled'] ) &&
|
||||
! empty( $_POST['stripe_create_account'] )
|
||||
! empty( $_POST['wc-wizard-service-stripe-enabled'] ) && // WPCS: CSRF ok, input var ok.
|
||||
! empty( $_POST['stripe_create_account'] ) // WPCS: CSRF ok, input var ok.
|
||||
) || (
|
||||
// Install WooCommerce Services with PayPal EC to enable proxied payments.
|
||||
! empty( $_POST['wc-wizard-service-ppec_paypal-enabled'] ) &&
|
||||
! empty( $_POST['ppec_paypal_reroute_requests'] )
|
||||
! empty( $_POST['wc-wizard-service-ppec_paypal-enabled'] ) && // WPCS: CSRF ok, input var ok.
|
||||
! empty( $_POST['ppec_paypal_reroute_requests'] ) // WPCS: CSRF ok, input var ok.
|
||||
)
|
||||
) {
|
||||
$this->install_woocommerce_services();
|
||||
|
@ -1479,13 +1499,11 @@ class WC_Admin_Setup_Wizard {
|
|||
|
||||
foreach ( $gateways as $gateway_id => $gateway ) {
|
||||
// If repo-slug is defined, download and install plugin from .org.
|
||||
if ( ! empty( $gateway['repo-slug'] ) && ! empty( $_POST[ 'wc-wizard-service-' . $gateway_id . '-enabled' ] ) ) {
|
||||
if ( ! empty( $gateway['repo-slug'] ) && ! empty( $_POST[ 'wc-wizard-service-' . $gateway_id . '-enabled' ] ) ) { // WPCS: CSRF ok, input var ok.
|
||||
$this->install_plugin( $gateway_id, $gateway );
|
||||
}
|
||||
|
||||
$settings_key = 'woocommerce_' . $gateway_id . '_settings';
|
||||
$settings = array_filter( (array) get_option( $settings_key, array() ) );
|
||||
$settings['enabled'] = ! empty( $_POST[ 'wc-wizard-service-' . $gateway_id . '-enabled' ] ) ? 'yes' : 'no';
|
||||
$settings = array( 'enabled' => ! empty( $_POST[ 'wc-wizard-service-' . $gateway_id . '-enabled' ] ) ? 'yes' : 'no' ); // WPCS: CSRF ok, input var ok.
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
if ( ! empty( $gateway['settings'] ) ) {
|
||||
|
@ -1497,7 +1515,13 @@ class WC_Admin_Setup_Wizard {
|
|||
}
|
||||
// @codingStandardsIgnoreSEnd
|
||||
|
||||
update_option( $settings_key, $settings );
|
||||
if ( 'ppec_paypal' === $gateway_id && empty( $settings['reroute_requests'] ) ) {
|
||||
unset( $settings['enabled'] );
|
||||
}
|
||||
|
||||
$settings_key = 'woocommerce_' . $gateway_id . '_settings';
|
||||
$previously_saved_settings = array_filter( (array) get_option( $settings_key, array() ) );
|
||||
update_option( $settings_key, array_merge( $previously_saved_settings, $settings ) );
|
||||
}
|
||||
|
||||
wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
|
||||
|
@ -1517,12 +1541,19 @@ class WC_Admin_Setup_Wizard {
|
|||
<div class="wc-wizard-service-description">
|
||||
<h3><?php esc_html_e( 'Storefront Theme', 'woocommerce' ); ?></h3>
|
||||
<p>
|
||||
<?php esc_html_e( 'Your theme is not compatible with WooCommerce. We recommend you switch to Storefront, a free WordPress theme built and maintained by the makers of WooCommerce. If toggled on, Storefront will be installed and activated for you.', 'woocommerce' ); ?>
|
||||
<?php
|
||||
$theme = wp_get_theme();
|
||||
$theme_name = $theme['Name'];
|
||||
|
||||
if ( $this->is_default_theme() ) {
|
||||
echo wp_kses_post( sprintf( __( 'The theme you are currently using is not optimized for WooCommerce. We recommend you switch to <a href="%s" title="Learn more about Storefront" target="_blank">Storefront</a>; our official, free, WooCommerce theme.', 'woocommerce' ), esc_url( 'https://woocommerce.com/storefront/' ) ) );
|
||||
} else {
|
||||
echo wp_kses_post( sprintf( __( 'The theme you are currently using does not fully support WooCommerce. We recommend you switch to <a href="%s" title="Learn more about Storefront" target="_blank">Storefront</a>; our official, free, WooCommerce theme.', 'woocommerce' ), esc_url( 'https://woocommerce.com/storefront/' ) ) );
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<p class="wc-wizard-service-learn-more">
|
||||
<a href="<?php echo esc_url( 'https://woocommerce.com/storefront/' ); ?>" target="_blank">
|
||||
<?php esc_html_e( 'Learn more about Storefront', 'woocommerce' ); ?>
|
||||
</a>
|
||||
<p>
|
||||
<?php echo wp_kses_post( sprintf( __( 'If toggled on, Storefront will be installed for you, and <em>%s</em> theme will be deactivated.', 'woocommerce' ), esc_html( $theme_name ) ) ); ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ class WC_Helper {
|
|||
$data['_actions'][] = $action;
|
||||
} else {
|
||||
$action = array(
|
||||
'message' => sprintf( __( 'To receive updates and support for this extension, you need to <strong>purchase</strong> a new subscription or <a href="%1$s" target="_blank">be added as a collaborator</a>.', 'woocommerce' ), 'https://docs.woocommerce.com/document/adding-collaborators/' ),
|
||||
'message' => sprintf( __( 'To receive updates and support for this extension, you need to <strong>purchase</strong> a new subscription or consolidate your extensions to one connected account by <strong><a href="%s" title="Sharing Docs">sharing</a> or <a href="%s" title="Transferring Docs">transferring</a></strong> this extension to this connected account.', 'woocommerce' ), 'https://docs.woocommerce.com/document/managing-woocommerce-com-subscriptions/#section-10', 'https://docs.woocommerce.com/document/managing-woocommerce-com-subscriptions/#section-5' ),
|
||||
'button_label' => __( 'Purchase', 'woocommerce' ),
|
||||
'button_url' => $data['_product_url'],
|
||||
'status' => 'expired',
|
||||
|
@ -1235,14 +1235,25 @@ class WC_Helper {
|
|||
|
||||
/**
|
||||
* Prompt a Helper connection if the user has WooCommerce.com extensions.
|
||||
*
|
||||
* @param string $screen_id Current screen ID.
|
||||
*/
|
||||
private static function _prompt_helper_connect( $screen_id ) {
|
||||
// Don't show the notice on the Helper screens.
|
||||
if ( 'woocommerce_page_wc-addons' == $screen_id && ! empty( $_REQUEST['section'] ) && 'helper' == $_REQUEST['section'] ) {
|
||||
$screens = wc_get_screen_ids();
|
||||
$screens[] = 'plugins';
|
||||
|
||||
if ( ! in_array( $screen_id, $screens, true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We believe have an active connection.
|
||||
// Don't show the notice on the Helper screens.
|
||||
$screen_addons = sanitize_title( __( 'WooCommerce', 'woocommerce' ) ) . '_page_wc-addons';
|
||||
|
||||
if ( $screen_addons === $screen_id && ! empty( $_REQUEST['section'] ) && 'helper' === $_REQUEST['section'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We believe we have an active connection.
|
||||
$auth = WC_Helper_Options::get( 'auth' );
|
||||
if ( ! empty( $auth['access_token'] ) ) {
|
||||
return;
|
||||
|
|
|
@ -244,7 +244,7 @@ class WC_Tax_Rate_Importer extends WP_Importer {
|
|||
echo '<div class="narrow">';
|
||||
echo '<p>' . esc_html__( 'Hi there! Upload a CSV file containing tax rates to import the contents into your shop. Choose a .csv file to upload, then click "Upload file and import".', 'woocommerce' ) . '</p>';
|
||||
|
||||
echo '<p>' . sprintf( esc_html__( 'Tax rates need to be defined with columns in a specific order (10 columns). <a href="%s">Click here to download a sample</a>.', 'woocommerce' ), esc_url( WC()->plugin_url() ) . '/dummy-data/sample_tax_rates.csv' ) . '</p>';
|
||||
echo '<p>' . sprintf( esc_html__( 'Tax rates need to be defined with columns in a specific order (10 columns). <a href="%s">Click here to download a sample</a>.', 'woocommerce' ), esc_url( WC()->plugin_url() ) . '/sample-data/sample_tax_rates.csv' ) . '</p>';
|
||||
|
||||
$action = 'admin.php?import=woocommerce_tax_rate_csv&step=1';
|
||||
|
||||
|
|
|
@ -459,9 +459,11 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
|
|||
<tbody>';
|
||||
|
||||
foreach ( $line_items as $item_id => $item ) {
|
||||
$product_object = is_callable( array( $item, 'get_product' ) ) ? $item->get_product() : null;
|
||||
|
||||
$html .= '<tr class="wc-order-preview-table__item wc-order-preview-table__item--' . esc_attr( $item_id ) . '">';
|
||||
$product_object = is_callable( array( $item, 'get_product' ) ) ? $item->get_product() : null;
|
||||
$row_class = apply_filters( 'woocommerce_admin_html_order_preview_item_class', '', $item, $order );
|
||||
|
||||
$html .= '<tr class="wc-order-preview-table__item wc-order-preview-table__item--' . esc_attr( $item_id ) . ( $row_class ? ' ' . esc_attr( $row_class ) : '' ) . '">';
|
||||
|
||||
foreach ( $columns as $column => $label ) {
|
||||
$html .= '<td class="wc-order-preview-table__column--' . esc_attr( $column ) . '">';
|
||||
|
|
|
@ -390,7 +390,7 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table {
|
|||
protected function query_filters( $query_vars ) {
|
||||
|
||||
if ( isset( $query_vars['orderby'] ) ) {
|
||||
if ( 'price' === $vars['orderby'] ) {
|
||||
if ( 'price' === $query_vars['orderby'] ) {
|
||||
// @codingStandardsIgnoreStart
|
||||
$query_vars = array_merge( $query_vars, array(
|
||||
'meta_key' => '_price',
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
/**
|
||||
* Linked product options.
|
||||
*
|
||||
* @package WooCommerce/admin
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
?>
|
||||
<div id="linked_product_data" class="panel woocommerce_options_panel hidden">
|
||||
|
||||
|
@ -10,16 +14,16 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<label for="grouped_products"><?php esc_html_e( 'Grouped products', 'woocommerce' ); ?></label>
|
||||
<select class="wc-product-search" multiple="multiple" style="width: 50%;" id="grouped_products" name="grouped_products[]" data-sortable="true" data-placeholder="<?php esc_attr_e( 'Search for a product…', 'woocommerce' ); ?>" data-action="woocommerce_json_search_products" data-exclude="<?php echo intval( $post->ID ); ?>">
|
||||
<?php
|
||||
$product_ids = $product_object->get_children( 'edit' );
|
||||
$product_ids = $product_object->is_type( 'grouped' ) ? $product_object->get_children( 'edit' ) : array();
|
||||
|
||||
foreach ( $product_ids as $product_id ) {
|
||||
$product = wc_get_product( $product_id );
|
||||
if ( is_object( $product ) ) {
|
||||
echo '<option value="' . esc_attr( $product_id ) . '"' . selected( true, true, false ) . '>' . wp_kses_post( $product->get_formatted_name() ) . '</option>';
|
||||
}
|
||||
foreach ( $product_ids as $product_id ) {
|
||||
$product = wc_get_product( $product_id );
|
||||
if ( is_object( $product ) ) {
|
||||
echo '<option value="' . esc_attr( $product_id ) . '"' . selected( true, true, false ) . '>' . wp_kses_post( $product->get_formatted_name() ) . '</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select> <?php echo wc_help_tip( __( 'This lets you choose which products are part of this group.', 'woocommerce' ) ); ?>
|
||||
</select> <?php echo wc_help_tip( __( 'This lets you choose which products are part of this group.', 'woocommerce' ) ); // WPCS: XSS ok. ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
@ -28,32 +32,32 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<label for="upsell_ids"><?php esc_html_e( 'Upsells', 'woocommerce' ); ?></label>
|
||||
<select class="wc-product-search" multiple="multiple" style="width: 50%;" id="upsell_ids" name="upsell_ids[]" data-placeholder="<?php esc_attr_e( 'Search for a product…', 'woocommerce' ); ?>" data-action="woocommerce_json_search_products_and_variations" data-exclude="<?php echo intval( $post->ID ); ?>">
|
||||
<?php
|
||||
$product_ids = $product_object->get_upsell_ids( 'edit' );
|
||||
$product_ids = $product_object->get_upsell_ids( 'edit' );
|
||||
|
||||
foreach ( $product_ids as $product_id ) {
|
||||
$product = wc_get_product( $product_id );
|
||||
if ( is_object( $product ) ) {
|
||||
echo '<option value="' . esc_attr( $product_id ) . '"' . selected( true, true, false ) . '>' . wp_kses_post( $product->get_formatted_name() ) . '</option>';
|
||||
}
|
||||
foreach ( $product_ids as $product_id ) {
|
||||
$product = wc_get_product( $product_id );
|
||||
if ( is_object( $product ) ) {
|
||||
echo '<option value="' . esc_attr( $product_id ) . '"' . selected( true, true, false ) . '>' . wp_kses_post( $product->get_formatted_name() ) . '</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select> <?php echo wc_help_tip( __( 'Upsells are products which you recommend instead of the currently viewed product, for example, products that are more profitable or better quality or more expensive.', 'woocommerce' ) ); ?>
|
||||
</select> <?php echo wc_help_tip( __( 'Upsells are products which you recommend instead of the currently viewed product, for example, products that are more profitable or better quality or more expensive.', 'woocommerce' ) ); // WPCS: XSS ok. ?>
|
||||
</p>
|
||||
|
||||
<p class="form-field hide_if_grouped hide_if_external">
|
||||
<label for="crosssell_ids"><?php esc_html_e( 'Cross-sells', 'woocommerce' ); ?></label>
|
||||
<select class="wc-product-search" multiple="multiple" style="width: 50%;" id="crosssell_ids" name="crosssell_ids[]" data-placeholder="<?php esc_attr_e( 'Search for a product…', 'woocommerce' ); ?>" data-action="woocommerce_json_search_products_and_variations" data-exclude="<?php echo intval( $post->ID ); ?>">
|
||||
<?php
|
||||
$product_ids = $product_object->get_cross_sell_ids( 'edit' );
|
||||
$product_ids = $product_object->get_cross_sell_ids( 'edit' );
|
||||
|
||||
foreach ( $product_ids as $product_id ) {
|
||||
$product = wc_get_product( $product_id );
|
||||
if ( is_object( $product ) ) {
|
||||
echo '<option value="' . esc_attr( $product_id ) . '"' . selected( true, true, false ) . '>' . wp_kses_post( $product->get_formatted_name() ) . '</option>';
|
||||
}
|
||||
foreach ( $product_ids as $product_id ) {
|
||||
$product = wc_get_product( $product_id );
|
||||
if ( is_object( $product ) ) {
|
||||
echo '<option value="' . esc_attr( $product_id ) . '"' . selected( true, true, false ) . '>' . wp_kses_post( $product->get_formatted_name() ) . '</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select> <?php echo wc_help_tip( __( 'Cross-sells are products which you promote in the cart, based on the current product.', 'woocommerce' ) ); ?>
|
||||
</select> <?php echo wc_help_tip( __( 'Cross-sells are products which you promote in the cart, based on the current product.', 'woocommerce' ) ); // WPCS: XSS ok. ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -206,10 +206,10 @@ class WC_Settings_General extends WC_Settings_Page {
|
|||
'default' => 'left',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'left' => __( 'Left', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . '‎99.99)',
|
||||
'right' => __( 'Right', 'woocommerce' ) . ' (99.99' . get_woocommerce_currency_symbol() . '‏)',
|
||||
'left_space' => __( 'Left with space', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . '‎ 99.99)',
|
||||
'right_space' => __( 'Right with space', 'woocommerce' ) . ' (99.99 ' . get_woocommerce_currency_symbol() . '‏)',
|
||||
'left' => __( 'Left', 'woocommerce' ),
|
||||
'right' => __( 'Right', 'woocommerce' ),
|
||||
'left_space' => __( 'Left with space', 'woocommerce' ),
|
||||
'right_space' => __( 'Right with space', 'woocommerce' ),
|
||||
),
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
|
|
@ -54,9 +54,38 @@ class WC_Settings_Products extends WC_Settings_Page {
|
|||
|
||||
$settings = $this->get_settings( $current_section );
|
||||
|
||||
$this->product_display_settings_moved_notice();
|
||||
|
||||
WC_Admin_Settings::output_fields( $settings );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a notice showing where some options have moved.
|
||||
*
|
||||
* @since 3.3.0
|
||||
* @todo remove in next major release.
|
||||
*/
|
||||
private function product_display_settings_moved_notice() {
|
||||
if ( get_user_meta( get_current_user_id(), 'dismissed_product_display_settings_moved_notice', true ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div id="message" class="updated woocommerce-message inline">
|
||||
<a class="woocommerce-message-close notice-dismiss" style="top:0;" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'product_display_settings_moved' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php esc_html_e( 'Dismiss', 'woocommerce' ); ?></a>
|
||||
|
||||
<p><?php
|
||||
/* translators: %s: URL to customizer. */
|
||||
echo wp_kses( sprintf( __( 'Looking for the product display options? They can now be found in the Customizer. <a href="%s">Go see them in action here.</a>', 'woocommerce' ), esc_url( admin_url( 'customize.php?url=' . wc_get_page_permalink( 'shop' ) . '&autofocus[panel]=woocommerce' ) ) ), array(
|
||||
'a' => array(
|
||||
'href' => array(),
|
||||
'title' => array(),
|
||||
),
|
||||
) );
|
||||
?></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Save settings.
|
||||
*/
|
||||
|
|
|
@ -186,7 +186,7 @@ class WC_Settings_Shipping extends WC_Settings_Page {
|
|||
break;
|
||||
}
|
||||
|
||||
// Increments the transient version to invalidate cache
|
||||
// Increments the transient version to invalidate cache.
|
||||
WC_Cache_Helper::get_transient_version( 'shipping', true );
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,9 @@ class WC_Settings_Tax extends WC_Settings_Page {
|
|||
$this->save_tax_rates();
|
||||
}
|
||||
|
||||
// Invalidate caches.
|
||||
WC_Cache_Helper::incr_cache_prefix( 'taxes' );
|
||||
WC_Cache_Helper::get_transient_version( 'shipping', true );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -488,12 +488,19 @@ class WC_REST_Orders_Controller extends WC_REST_Legacy_Orders_Controller {
|
|||
return $object;
|
||||
}
|
||||
|
||||
if ( $creating ) {
|
||||
if ( ! is_null( $request['customer_id'] ) && 0 !== $request['customer_id'] ) {
|
||||
// Make sure customer exists.
|
||||
if ( ! is_null( $request['customer_id'] ) && 0 !== $request['customer_id'] && false === get_user_by( 'id', $request['customer_id'] ) ) {
|
||||
if ( false === get_user_by( 'id', $request['customer_id'] ) ) {
|
||||
throw new WC_REST_Exception( 'woocommerce_rest_invalid_customer_id',__( 'Customer ID is invalid.', 'woocommerce' ), 400 );
|
||||
}
|
||||
|
||||
// Make sure customer is part of blog.
|
||||
if ( is_multisite() && ! is_user_member_of_blog( $request['customer_id'] ) ) {
|
||||
throw new WC_REST_Exception( 'woocommerce_rest_invalid_customer_id_network',__( 'Customer ID does not belong to this site.', 'woocommerce' ), 400 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $creating ) {
|
||||
$object->set_created_via( 'rest-api' );
|
||||
$object->set_prices_include_tax( 'yes' === get_option( 'woocommerce_prices_include_tax' ) );
|
||||
$object->calculate_totals();
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
*
|
||||
* Handles requests to the /products/<product_id>/variations endpoints.
|
||||
*
|
||||
* @author WooThemes
|
||||
* @category API
|
||||
* @package WooCommerce/API
|
||||
* @package WooCommerce\API
|
||||
* @since 3.0.0
|
||||
*/
|
||||
|
||||
|
@ -379,16 +377,18 @@ class WC_REST_Product_Variations_Controller extends WC_REST_Products_Controller
|
|||
|
||||
// Check ID for global attributes or name for product attributes.
|
||||
if ( ! empty( $attribute['id'] ) ) {
|
||||
$attribute_id = absint( $attribute['id'] );
|
||||
$attribute_name = wc_attribute_taxonomy_name_by_id( $attribute_id );
|
||||
$attribute_id = absint( $attribute['id'] );
|
||||
$raw_attribute_name = wc_attribute_taxonomy_name_by_id( $attribute_id );
|
||||
} elseif ( ! empty( $attribute['name'] ) ) {
|
||||
$attribute_name = sanitize_title( $attribute['name'] );
|
||||
$raw_attribute_name = sanitize_title( $attribute['name'] );
|
||||
}
|
||||
|
||||
if ( ! $attribute_id && ! $attribute_name ) {
|
||||
if ( ! $attribute_id && ! $raw_attribute_name ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$attribute_name = sanitize_title( $raw_attribute_name );
|
||||
|
||||
if ( ! isset( $parent_attributes[ $attribute_name ] ) || ! $parent_attributes[ $attribute_name ]->get_variation() ) {
|
||||
continue;
|
||||
}
|
||||
|
@ -398,9 +398,7 @@ class WC_REST_Product_Variations_Controller extends WC_REST_Products_Controller
|
|||
|
||||
if ( $parent_attributes[ $attribute_name ]->is_taxonomy() ) {
|
||||
// If dealing with a taxonomy, we need to get the slug from the name posted to the API.
|
||||
// @codingStandardsIgnoreStart
|
||||
$term = get_term_by( 'name', $attribute_value, $attribute_name );
|
||||
// @codingStandardsIgnoreEnd
|
||||
$term = get_term_by( 'name', $attribute_value, $raw_attribute_name ); // @codingStandardsIgnoreLine
|
||||
|
||||
if ( $term && ! is_wp_error( $term ) ) {
|
||||
$attribute_value = $term->slug;
|
||||
|
|
|
@ -153,7 +153,7 @@ class WC_REST_System_Status_Tools_Controller extends WC_REST_Controller {
|
|||
'desc' => sprintf(
|
||||
'<strong class="red">%1$s</strong> %2$s',
|
||||
__( 'Note:', 'woocommerce' ),
|
||||
__( 'This tool will delete all customer session data from the database, including any current live carts.', 'woocommerce' )
|
||||
__( 'This tool will delete all customer session data from the database, including current carts and saved carts in the database.', 'woocommerce' )
|
||||
),
|
||||
),
|
||||
'install_pages' => array(
|
||||
|
@ -424,8 +424,9 @@ class WC_REST_System_Status_Tools_Controller extends WC_REST_Controller {
|
|||
break;
|
||||
case 'clear_sessions' :
|
||||
$wpdb->query( "TRUNCATE {$wpdb->prefix}woocommerce_sessions" );
|
||||
$result = absint( $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key='_woocommerce_persistent_cart_" . get_current_blog_id() . "';" ) );
|
||||
wp_cache_flush();
|
||||
$message = __( 'Sessions successfully cleared', 'woocommerce' );
|
||||
$message = sprintf( __( 'Deleted all active sessions, and %d saved carts.', 'woocommerce' ), absint( $result ) );
|
||||
break;
|
||||
case 'install_pages' :
|
||||
WC_Install::create_pages();
|
||||
|
|
|
@ -249,6 +249,11 @@ class WC_REST_Legacy_Orders_Controller extends WC_REST_CRUD_Controller {
|
|||
throw new WC_REST_Exception( 'woocommerce_rest_invalid_customer_id',__( 'Customer ID is invalid.', 'woocommerce' ), 400 );
|
||||
}
|
||||
|
||||
// Make sure customer is part of blog.
|
||||
if ( is_multisite() && ! is_user_member_of_blog( $request['customer_id'] ) ) {
|
||||
throw new WC_REST_Exception( 'woocommerce_rest_invalid_customer_id_network',__( 'Customer ID does not belong to this site.', 'woocommerce' ), 400 );
|
||||
}
|
||||
|
||||
$order = $this->prepare_item_for_database( $request );
|
||||
$order->set_created_via( 'rest-api' );
|
||||
$order->set_prices_include_tax( 'yes' === get_option( 'woocommerce_prices_include_tax' ) );
|
||||
|
|
|
@ -534,6 +534,11 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller {
|
|||
throw new WC_REST_Exception( 'woocommerce_rest_invalid_customer_id',__( 'Customer ID is invalid.', 'woocommerce' ), 400 );
|
||||
}
|
||||
|
||||
// Make sure customer is part of blog.
|
||||
if ( is_multisite() && ! is_user_member_of_blog( $request['customer_id'] ) ) {
|
||||
throw new WC_REST_Exception( 'woocommerce_rest_invalid_customer_id_network',__( 'Customer ID does not belong to this site.', 'woocommerce' ), 400 );
|
||||
}
|
||||
|
||||
$order = $this->prepare_item_for_database( $request );
|
||||
$order->set_created_via( 'rest-api' );
|
||||
$order->set_prices_include_tax( 'yes' === get_option( 'woocommerce_prices_include_tax' ) );
|
||||
|
|
|
@ -1426,17 +1426,19 @@ class WC_AJAX {
|
|||
wp_die();
|
||||
}
|
||||
|
||||
$ids = array();
|
||||
// Search by ID.
|
||||
if ( is_numeric( $term ) ) {
|
||||
$customer = new WC_Customer( intval( $term ) );
|
||||
|
||||
// Customer does not exists.
|
||||
if ( 0 === $customer->get_id() ) {
|
||||
wp_die();
|
||||
if ( 0 !== $customer->get_id() ) {
|
||||
$ids = array( $customer->get_id() );
|
||||
}
|
||||
}
|
||||
|
||||
$ids = array( $customer->get_id() );
|
||||
} else {
|
||||
// Usernames can be numeric so we first check that no users was found by ID before searching for numeric username, this prevents performance issues with ID lookups.
|
||||
if ( empty( $ids ) ) {
|
||||
$data_store = WC_Data_Store::load( 'customer' );
|
||||
|
||||
// If search is smaller than 3 characters, limit result set to avoid
|
||||
|
@ -2347,6 +2349,9 @@ class WC_AJAX {
|
|||
}
|
||||
}
|
||||
|
||||
WC_Cache_Helper::incr_cache_prefix( 'taxes' );
|
||||
WC_Cache_Helper::get_transient_version( 'shipping', true );
|
||||
|
||||
wp_send_json_success( array(
|
||||
'rates' => WC_Tax::get_rates_for_tax_class( $current_class ),
|
||||
) );
|
||||
|
|
|
@ -118,14 +118,14 @@ class WC_Cache_Helper {
|
|||
/**
|
||||
* Get transient version.
|
||||
*
|
||||
* When using transients with unpredictable names, e.g. those containing an md5.
|
||||
* When using transients with unpredictable names, e.g. those containing an md5
|
||||
* hash in the name, we need a way to invalidate them all at once.
|
||||
*
|
||||
* When using default WP transients we're able to do this with a DB query to.
|
||||
* When using default WP transients we're able to do this with a DB query to
|
||||
* delete transients manually.
|
||||
*
|
||||
* With external cache however, this isn't possible. Instead, this function is used.
|
||||
* to append a unique string (based on time()) to each transient. When transients.
|
||||
* With external cache however, this isn't possible. Instead, this function is used
|
||||
* to append a unique string (based on time()) to each transient. When transients
|
||||
* are invalidated, the transient version will increment and data will be regenerated.
|
||||
*
|
||||
* Raised in issue https://github.com/woocommerce/woocommerce/issues/5777.
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* Enables WooCommerce, via the the command line.
|
||||
*
|
||||
* @package WooCommerce\CLI
|
||||
* @version 3.0.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables WooCommerce, via the the command line.
|
||||
*
|
||||
* @version 3.0.0
|
||||
* @package WooCommerce
|
||||
* @author WooCommerce
|
||||
* CLI class.
|
||||
*/
|
||||
class WC_CLI {
|
||||
/**
|
||||
|
@ -23,10 +26,10 @@ class WC_CLI {
|
|||
* Load command files.
|
||||
*/
|
||||
private function includes() {
|
||||
require_once __DIR__ . '/cli/class-wc-cli-runner.php';
|
||||
require_once __DIR__ . '/cli/class-wc-cli-rest-command.php';
|
||||
require_once __DIR__ . '/cli/class-wc-cli-tool-command.php';
|
||||
require_once __DIR__ . '/cli/class-wc-cli-update-command.php';
|
||||
require_once dirname( __FILE__ ) . '/cli/class-wc-cli-runner.php';
|
||||
require_once dirname( __FILE__ ) . '/cli/class-wc-cli-rest-command.php';
|
||||
require_once dirname( __FILE__ ) . '/cli/class-wc-cli-tool-command.php';
|
||||
require_once dirname( __FILE__ ) . '/cli/class-wc-cli-update-command.php';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,4 +42,4 @@ class WC_CLI {
|
|||
}
|
||||
}
|
||||
|
||||
new WC_CLI;
|
||||
new WC_CLI();
|
||||
|
|
|
@ -212,7 +212,7 @@ class WC_Discounts {
|
|||
* @return int
|
||||
*/
|
||||
public function get_discounted_price_in_cents( $item ) {
|
||||
return absint( $item->price - $this->get_discount( $item->key, true ) );
|
||||
return absint( round( $item->price - $this->get_discount( $item->key, true ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -172,7 +172,6 @@ class WC_Form_Handler {
|
|||
* Save the password/account details and redirect back to the my account page.
|
||||
*/
|
||||
public static function save_account_details() {
|
||||
|
||||
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
@ -183,31 +182,34 @@ class WC_Form_Handler {
|
|||
|
||||
wc_nocache_headers();
|
||||
|
||||
$errors = new WP_Error();
|
||||
$user = new stdClass();
|
||||
$user_id = get_current_user_id();
|
||||
|
||||
$user->ID = (int) get_current_user_id();
|
||||
$current_user = get_user_by( 'id', $user->ID );
|
||||
|
||||
if ( $user->ID <= 0 ) {
|
||||
if ( $user_id <= 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$account_first_name = ! empty( $_POST['account_first_name'] ) ? wc_clean( $_POST['account_first_name'] ) : '';
|
||||
$account_last_name = ! empty( $_POST['account_last_name'] ) ? wc_clean( $_POST['account_last_name'] ) : '';
|
||||
$account_email = ! empty( $_POST['account_email'] ) ? wc_clean( $_POST['account_email'] ) : '';
|
||||
$pass_cur = ! empty( $_POST['password_current'] ) ? $_POST['password_current'] : '';
|
||||
$pass1 = ! empty( $_POST['password_1'] ) ? $_POST['password_1'] : '';
|
||||
$pass2 = ! empty( $_POST['password_2'] ) ? $_POST['password_2'] : '';
|
||||
$current_user = get_user_by( 'id', $user_id );
|
||||
$current_first_name = $current_user->first_name;
|
||||
$current_last_name = $current_user->last_name;
|
||||
$current_email = $current_user->user_email;
|
||||
|
||||
$account_first_name = ! empty( $_POST['account_first_name'] ) ? wc_clean( $_POST['account_first_name'] ): '';
|
||||
$account_last_name = ! empty( $_POST['account_last_name'] ) ? wc_clean( $_POST['account_last_name'] ) : '';
|
||||
$account_email = ! empty( $_POST['account_email'] ) ? wc_clean( $_POST['account_email'] ) : '';
|
||||
$pass_cur = ! empty( $_POST['password_current'] ) ? $_POST['password_current'] : '';
|
||||
$pass1 = ! empty( $_POST['password_1'] ) ? $_POST['password_1'] : '';
|
||||
$pass2 = ! empty( $_POST['password_2'] ) ? $_POST['password_2'] : '';
|
||||
$save_pass = true;
|
||||
|
||||
$user = new stdClass();
|
||||
$user->ID = $user_id;
|
||||
$user->first_name = $account_first_name;
|
||||
$user->last_name = $account_last_name;
|
||||
|
||||
// Prevent emails being displayed, or leave alone.
|
||||
$user->display_name = is_email( $current_user->display_name ) ? $user->first_name : $current_user->display_name;
|
||||
|
||||
// Handle required fields
|
||||
// Handle required fields.
|
||||
$required_fields = apply_filters( 'woocommerce_save_account_details_required_fields', array(
|
||||
'account_first_name' => __( 'First name', 'woocommerce' ),
|
||||
'account_last_name' => __( 'Last name', 'woocommerce' ),
|
||||
|
@ -252,6 +254,7 @@ class WC_Form_Handler {
|
|||
}
|
||||
|
||||
// Allow plugins to return their own errors.
|
||||
$errors = new WP_Error();
|
||||
do_action_ref_array( 'woocommerce_save_account_details_errors', array( &$errors, &$user ) );
|
||||
|
||||
if ( $errors->get_error_messages() ) {
|
||||
|
@ -261,9 +264,28 @@ class WC_Form_Handler {
|
|||
}
|
||||
|
||||
if ( wc_notice_count( 'error' ) === 0 ) {
|
||||
|
||||
wp_update_user( $user );
|
||||
|
||||
// Update customer object to keep data in sync.
|
||||
$customer = new WC_Customer( $user->ID );
|
||||
|
||||
if ( $customer ) {
|
||||
// Keep billing data in sync if data changed.
|
||||
if ( is_email( $user->user_email ) && $current_email !== $user->user_email ) {
|
||||
$customer->set_billing_email( $user->user_email );
|
||||
}
|
||||
|
||||
if ( $current_first_name !== $user->first_name ) {
|
||||
$customer->set_billing_first_name( $user->first_name );
|
||||
}
|
||||
|
||||
if ( $current_last_name !== $user->last_name ) {
|
||||
$customer->set_billing_last_name( $user->last_name );
|
||||
}
|
||||
|
||||
$customer->save();
|
||||
}
|
||||
|
||||
wc_add_notice( __( 'Account details changed successfully.', 'woocommerce' ) );
|
||||
|
||||
do_action( 'woocommerce_save_account_details', $user->ID );
|
||||
|
|
|
@ -516,6 +516,7 @@ class WC_Frontend_Scripts {
|
|||
$params = array(
|
||||
'ajax_url' => WC()->ajax_url(),
|
||||
'wc_ajax_url' => WC_AJAX::get_endpoint( "%%endpoint%%" ),
|
||||
'cart_hash_key' => apply_filters( 'woocommerce_cart_hash_key', 'wc_cart_hash_' . md5( get_current_blog_id() . '_' . get_site_url( get_current_blog_id(), '/' ) ) ),
|
||||
'fragment_name' => apply_filters( 'woocommerce_cart_fragment_name', 'wc_fragments_' . md5( get_current_blog_id() . '_' . get_site_url( get_current_blog_id(), '/' ) ) ),
|
||||
);
|
||||
break;
|
||||
|
|
|
@ -100,6 +100,7 @@ class WC_Install {
|
|||
'wc_update_330_product_stock_status',
|
||||
'wc_update_330_set_default_product_cat',
|
||||
'wc_update_330_clear_transients',
|
||||
'wc_update_330_set_paypal_sandbox_credentials',
|
||||
'wc_update_330_db_version',
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1339,7 +1339,7 @@ class WC_Order extends WC_Abstract_Order {
|
|||
if ( $item->is_type( 'line_item' ) ) {
|
||||
$product = $item->get_product();
|
||||
|
||||
if ( $product->has_file() ) {
|
||||
if ( $product && $product->has_file() ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1535,6 +1535,16 @@ class WC_Order extends WC_Abstract_Order {
|
|||
return apply_filters( 'woocommerce_get_view_order_url', wc_get_endpoint_url( 'view-order', $this->get_id(), wc_get_page_permalink( 'myaccount' ) ), $this );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get's the URL to edit the order in the backend.
|
||||
*
|
||||
* @since 3.3.0
|
||||
* @return string
|
||||
*/
|
||||
public function get_edit_order_url() {
|
||||
return apply_filters( 'woocommerce_get_edit_order_url', get_admin_url( null, 'post.php?post=' . $this->get_id() . '&action=edit' ), $this );
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Order notes.
|
||||
|
|
|
@ -277,8 +277,8 @@ class WC_Post_types {
|
|||
'edit' => __( 'Edit', 'woocommerce' ),
|
||||
'edit_item' => __( 'Edit product', 'woocommerce' ),
|
||||
'new_item' => __( 'New product', 'woocommerce' ),
|
||||
'view' => __( 'View product', 'woocommerce' ),
|
||||
'view_item' => __( 'View product', 'woocommerce' ),
|
||||
'view_items' => __( 'View products', 'woocommerce' ),
|
||||
'search_items' => __( 'Search products', 'woocommerce' ),
|
||||
'not_found' => __( 'No products found', 'woocommerce' ),
|
||||
'not_found_in_trash' => __( 'No products found in trash', 'woocommerce' ),
|
||||
|
@ -336,7 +336,6 @@ class WC_Post_types {
|
|||
'edit' => __( 'Edit', 'woocommerce' ),
|
||||
'edit_item' => __( 'Edit order', 'woocommerce' ),
|
||||
'new_item' => __( 'New order', 'woocommerce' ),
|
||||
'view' => __( 'View order', 'woocommerce' ),
|
||||
'view_item' => __( 'View order', 'woocommerce' ),
|
||||
'search_items' => __( 'Search orders', 'woocommerce' ),
|
||||
'not_found' => __( 'No orders found', 'woocommerce' ),
|
||||
|
@ -399,7 +398,6 @@ class WC_Post_types {
|
|||
'edit' => __( 'Edit', 'woocommerce' ),
|
||||
'edit_item' => __( 'Edit coupon', 'woocommerce' ),
|
||||
'new_item' => __( 'New coupon', 'woocommerce' ),
|
||||
'view' => __( 'View coupons', 'woocommerce' ),
|
||||
'view_item' => __( 'View coupon', 'woocommerce' ),
|
||||
'search_items' => __( 'Search coupons', 'woocommerce' ),
|
||||
'not_found' => __( 'No coupons found', 'woocommerce' ),
|
||||
|
|
|
@ -47,7 +47,7 @@ class WC_Product_Download implements ArrayAccess {
|
|||
*/
|
||||
public function get_type_of_file_path( $file_path = '' ) {
|
||||
$file_path = $file_path ? $file_path : $this->get_file();
|
||||
if ( 0 === strpos( $file_path, 'http' ) ) {
|
||||
if ( 0 === strpos( $file_path, 'http' ) || 0 === strpos( $file_path, '//' ) ) {
|
||||
return 'absolute';
|
||||
} elseif ( '[' === substr( $file_path, 0, 1 ) && ']' === substr( $file_path, -1 ) ) {
|
||||
return 'shortcode';
|
||||
|
|
|
@ -141,20 +141,28 @@ class WC_Session_Handler extends WC_Session {
|
|||
*
|
||||
* Uses Portable PHP password hashing framework to generate a unique cryptographically strong ID.
|
||||
*
|
||||
* @return int|string
|
||||
* @return string
|
||||
*/
|
||||
public function generate_customer_id() {
|
||||
$customer_id = '';
|
||||
|
||||
if ( is_user_logged_in() ) {
|
||||
return get_current_user_id();
|
||||
} else {
|
||||
require_once ABSPATH . 'wp-includes/class-phpass.php';
|
||||
$hasher = new PasswordHash( 8, false );
|
||||
return md5( $hasher->get_random_bytes( 32 ) );
|
||||
$customer_id = get_current_user_id();
|
||||
}
|
||||
|
||||
if ( empty( $customer_id ) ) {
|
||||
require_once ABSPATH . 'wp-includes/class-phpass.php';
|
||||
$hasher = new PasswordHash( 8, false );
|
||||
$customer_id = md5( $hasher->get_random_bytes( 32 ) );
|
||||
}
|
||||
|
||||
return $customer_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get session cookie.
|
||||
* Get the session cookie, if set. Otherwise return false.
|
||||
*
|
||||
* Session cookies without a customer ID are invalid.
|
||||
*
|
||||
* @return bool|array
|
||||
*/
|
||||
|
@ -167,6 +175,10 @@ class WC_Session_Handler extends WC_Session {
|
|||
|
||||
list( $customer_id, $session_expiration, $session_expiring, $cookie_hash ) = explode( '||', $cookie_value );
|
||||
|
||||
if ( empty( $customer_id ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Validate hash.
|
||||
$to_hash = $customer_id . '|' . $session_expiration;
|
||||
$hash = hash_hmac( 'md5', $to_hash, wp_hash( $to_hash ) );
|
||||
|
|
|
@ -1,22 +1,25 @@
|
|||
<?php
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Structured data's handler and generator using JSON-LD format.
|
||||
*
|
||||
* @class WC_Structured_Data
|
||||
* @since 3.0.0
|
||||
* @version 3.0.0
|
||||
* @package WooCommerce/Classes
|
||||
* @author Clément Cazaud <opportus@gmail.com>
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* WC_Structured_Data class.
|
||||
*/
|
||||
class WC_Structured_Data {
|
||||
|
||||
/**
|
||||
* @var array $_data
|
||||
* Stores the structured data.
|
||||
*
|
||||
* @var array $_data Array of structured data.
|
||||
*/
|
||||
private $_data = array();
|
||||
|
||||
|
@ -128,9 +131,9 @@ class WC_Structured_Data {
|
|||
/**
|
||||
* Makes sure email structured data only outputs on non-plain text versions.
|
||||
*
|
||||
* @param WP_Order $order Order data.
|
||||
* @param bool $sent_to_admin Send to admin (default: false).
|
||||
* @param bool $plain_text Plain text email (default: false).
|
||||
* @param WP_Order $order Order data.
|
||||
* @param bool $sent_to_admin Send to admin (default: false).
|
||||
* @param bool $plain_text Plain text email (default: false).
|
||||
*/
|
||||
public function output_email_structured_data( $order, $sent_to_admin = false, $plain_text = false ) {
|
||||
if ( $plain_text ) {
|
||||
|
@ -149,8 +152,9 @@ class WC_Structured_Data {
|
|||
*/
|
||||
public function output_structured_data() {
|
||||
$types = $this->get_data_type_for_page();
|
||||
$data = wc_clean( $this->get_structured_data( $types ) );
|
||||
|
||||
if ( $data = wc_clean( $this->get_structured_data( $types ) ) ) {
|
||||
if ( $data ) {
|
||||
echo '<script type="application/ld+json">' . wp_json_encode( $data ) . '</script>';
|
||||
}
|
||||
}
|
||||
|
@ -213,8 +217,8 @@ class WC_Structured_Data {
|
|||
|
||||
if ( '' !== $product->get_price() ) {
|
||||
if ( $product->is_type( 'variable' ) ) {
|
||||
$prices = $product->get_variation_prices();
|
||||
$lowest = reset( $prices['price'] );
|
||||
$prices = $product->get_variation_prices();
|
||||
$lowest = reset( $prices['price'] );
|
||||
$highest = end( $prices['price'] );
|
||||
|
||||
if ( $lowest === $highest ) {
|
||||
|
@ -250,11 +254,10 @@ class WC_Structured_Data {
|
|||
$markup['offers'] = array( apply_filters( 'woocommerce_structured_data_product_offer', $markup_offer, $product ) );
|
||||
}
|
||||
|
||||
if ( $product->get_rating_count() ) {
|
||||
if ( $product->get_review_count() ) {
|
||||
$markup['aggregateRating'] = array(
|
||||
'@type' => 'AggregateRating',
|
||||
'ratingValue' => $product->get_average_rating(),
|
||||
'ratingCount' => $product->get_rating_count(),
|
||||
'reviewCount' => $product->get_review_count(),
|
||||
);
|
||||
}
|
||||
|
@ -279,18 +282,20 @@ class WC_Structured_Data {
|
|||
'@type' => 'Product',
|
||||
'name' => get_the_title( $comment->comment_post_ID ),
|
||||
);
|
||||
if ( $rating = get_comment_meta( $comment->comment_ID, 'rating', true ) ) {
|
||||
$markup['reviewRating'] = array(
|
||||
|
||||
// Skip replies unless they have a rating.
|
||||
$rating = get_comment_meta( $comment->comment_ID, 'rating', true );
|
||||
|
||||
if ( $rating ) {
|
||||
$markup['reviewRating'] = array(
|
||||
'@type' => 'rating',
|
||||
'ratingValue' => $rating,
|
||||
);
|
||||
|
||||
// Skip replies unless they have a rating.
|
||||
} elseif ( $comment->comment_parent ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$markup['author'] = array(
|
||||
$markup['author'] = array(
|
||||
'@type' => 'Person',
|
||||
'name' => get_comment_author( $comment->comment_ID ),
|
||||
);
|
||||
|
@ -325,7 +330,7 @@ class WC_Structured_Data {
|
|||
),
|
||||
);
|
||||
|
||||
if ( ! empty( $crumb[1] ) && sizeof( $crumbs ) !== $key + 1 ) {
|
||||
if ( ! empty( $crumb[1] ) && count( $crumbs ) !== $key + 1 ) {
|
||||
$markup['itemListElement'][ $key ]['item'] += array( '@id' => $crumb[1] );
|
||||
}
|
||||
}
|
||||
|
@ -357,9 +362,9 @@ class WC_Structured_Data {
|
|||
*
|
||||
* Hooked into `woocommerce_email_order_details` action hook.
|
||||
*
|
||||
* @param WP_Order $order Order data.
|
||||
* @param bool $sent_to_admin Send to admin (default: false).
|
||||
* @param bool $plain_text Plain text email (default: false).
|
||||
* @param WP_Order $order Order data.
|
||||
* @param bool $sent_to_admin Send to admin (default: false).
|
||||
* @param bool $plain_text Plain text email (default: false).
|
||||
*/
|
||||
public function generate_order_data( $order, $sent_to_admin = false, $plain_text = false ) {
|
||||
if ( $plain_text || ! is_a( $order, 'WC_Order' ) ) {
|
||||
|
@ -368,7 +373,7 @@ class WC_Structured_Data {
|
|||
|
||||
$shop_name = get_bloginfo( 'name' );
|
||||
$shop_url = home_url();
|
||||
$order_url = $sent_to_admin ? admin_url( 'post.php?post=' . absint( $order->get_id() ) . '&action=edit' ) : $order->get_view_order_url();
|
||||
$order_url = $sent_to_admin ? $order->get_edit_order_url() : $order->get_view_order_url();
|
||||
$order_statuses = array(
|
||||
'pending' => 'https://schema.org/OrderPaymentDue',
|
||||
'processing' => 'https://schema.org/OrderProcessing',
|
||||
|
@ -389,7 +394,7 @@ class WC_Structured_Data {
|
|||
$product_exists = is_object( $product );
|
||||
$is_visible = $product_exists && $product->is_visible();
|
||||
|
||||
$markup_offers[] = array(
|
||||
$markup_offers[] = array(
|
||||
'@type' => 'Offer',
|
||||
'price' => $order->get_line_subtotal( $item ),
|
||||
'priceCurrency' => $order->get_currency(),
|
||||
|
|
|
@ -113,45 +113,44 @@ class WC_Tax {
|
|||
/**
|
||||
* Calc tax from inclusive price.
|
||||
*
|
||||
* @param float $price
|
||||
* @param array $rates
|
||||
* @param float $price Price to calcualte tax for.
|
||||
* @param array $rates Array of tax rates.
|
||||
* @return array
|
||||
*/
|
||||
public static function calc_inclusive_tax( $price, $rates ) {
|
||||
$taxes = array();
|
||||
|
||||
$regular_tax_rates = $compound_tax_rates = 0;
|
||||
$taxes = array();
|
||||
$compound_rates = array();
|
||||
$regular_rates = array();
|
||||
|
||||
// Index array so taxes are output in correct order and see what compound/regular rates we have to calculate.
|
||||
foreach ( $rates as $key => $rate ) {
|
||||
$taxes[ $key ] = 0;
|
||||
|
||||
if ( 'yes' === $rate['compound'] ) {
|
||||
$compound_tax_rates = $compound_tax_rates + $rate['rate'];
|
||||
$compound_rates[ $key ] = $rate['rate'];
|
||||
} else {
|
||||
$regular_tax_rates = $regular_tax_rates + $rate['rate'];
|
||||
$regular_rates[ $key ] = $rate['rate'];
|
||||
}
|
||||
}
|
||||
|
||||
$regular_tax_rate = 1 + ( $regular_tax_rates / 100 );
|
||||
$compound_tax_rate = 1 + ( $compound_tax_rates / 100 );
|
||||
$non_compound_price = $price / $compound_tax_rate;
|
||||
$compound_rates = array_reverse( $compound_rates, true ); // Working backwards.
|
||||
|
||||
foreach ( $rates as $key => $rate ) {
|
||||
if ( ! isset( $taxes[ $key ] ) ) {
|
||||
$taxes[ $key ] = 0;
|
||||
}
|
||||
$non_compound_price = $price;
|
||||
|
||||
$the_rate = $rate['rate'] / 100;
|
||||
foreach ( $compound_rates as $key => $compound_rate ) {
|
||||
$tax_amount = apply_filters( 'woocommerce_price_inc_tax_amount', $non_compound_price - ( $non_compound_price / ( 1 + ( $compound_rate / 100 ) ) ), $key, $rates[ $key ], $price );
|
||||
$taxes[ $key ] += $tax_amount;
|
||||
$non_compound_price = $non_compound_price - $tax_amount;
|
||||
}
|
||||
|
||||
if ( 'yes' === $rate['compound'] ) {
|
||||
$the_price = $price;
|
||||
$the_rate = $the_rate / $compound_tax_rate;
|
||||
} else {
|
||||
$the_price = $non_compound_price;
|
||||
$the_rate = $the_rate / $regular_tax_rate;
|
||||
}
|
||||
// Regular taxes.
|
||||
$regular_tax_rate = 1 + ( array_sum( $regular_rates ) / 100 );
|
||||
|
||||
$net_price = $price - ( $the_rate * $the_price );
|
||||
$tax_amount = $price - $net_price;
|
||||
$taxes[ $key ] += apply_filters( 'woocommerce_price_inc_tax_amount', $tax_amount, $key, $rate, $price );
|
||||
foreach ( $regular_rates as $key => $regular_rate ) {
|
||||
$the_rate = ( $regular_rate / 100 ) / $regular_tax_rate;
|
||||
$net_price = $price - ( $the_rate * $non_compound_price );
|
||||
$tax_amount = apply_filters( 'woocommerce_price_inc_tax_amount', $price - $net_price, $key, $rates[ $key ], $price );
|
||||
$taxes[ $key ] += $tax_amount;
|
||||
}
|
||||
|
||||
return $taxes;
|
||||
|
@ -160,27 +159,22 @@ class WC_Tax {
|
|||
/**
|
||||
* Calc tax from exclusive price.
|
||||
*
|
||||
* @param float $price
|
||||
* @param array $rates
|
||||
* @param float $price Price to calcualte tax for.
|
||||
* @param array $rates Array of tax rates.
|
||||
* @return array
|
||||
*/
|
||||
public static function calc_exclusive_tax( $price, $rates ) {
|
||||
$taxes = array();
|
||||
|
||||
if ( ! empty( $rates ) ) {
|
||||
// Multiple taxes
|
||||
foreach ( $rates as $key => $rate ) {
|
||||
|
||||
if ( 'yes' === $rate['compound'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$tax_amount = $price * ( $rate['rate'] / 100 );
|
||||
$tax_amount = apply_filters( 'woocommerce_price_ex_tax_amount', $tax_amount, $key, $rate, $price ); // ADVANCED: Allow third parties to modify this rate.
|
||||
|
||||
// ADVANCED: Allow third parties to modify this rate
|
||||
$tax_amount = apply_filters( 'woocommerce_price_ex_tax_amount', $tax_amount, $key, $rate, $price );
|
||||
|
||||
// Add rate
|
||||
if ( ! isset( $taxes[ $key ] ) ) {
|
||||
$taxes[ $key ] = $tax_amount;
|
||||
} else {
|
||||
|
@ -190,26 +184,22 @@ class WC_Tax {
|
|||
|
||||
$pre_compound_total = array_sum( $taxes );
|
||||
|
||||
// Compound taxes
|
||||
// Compound taxes.
|
||||
foreach ( $rates as $key => $rate ) {
|
||||
|
||||
if ( 'no' === $rate['compound'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$the_price_inc_tax = $price + ( $pre_compound_total );
|
||||
$tax_amount = $the_price_inc_tax * ( $rate['rate'] / 100 );
|
||||
$tax_amount = apply_filters( 'woocommerce_price_ex_tax_amount', $tax_amount, $key, $rate, $price, $the_price_inc_tax, $pre_compound_total ); // ADVANCED: Allow third parties to modify this rate.
|
||||
|
||||
$tax_amount = $the_price_inc_tax * ( $rate['rate'] / 100 );
|
||||
|
||||
// ADVANCED: Allow third parties to modify this rate
|
||||
$tax_amount = apply_filters( 'woocommerce_price_ex_tax_amount', $tax_amount, $key, $rate, $price, $the_price_inc_tax, $pre_compound_total );
|
||||
|
||||
// Add rate
|
||||
if ( ! isset( $taxes[ $key ] ) ) {
|
||||
$taxes[ $key ] = $tax_amount;
|
||||
} else {
|
||||
$taxes[ $key ] += $tax_amount;
|
||||
}
|
||||
|
||||
$pre_compound_total = array_sum( $taxes );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -176,6 +176,7 @@ final class WooCommerce {
|
|||
add_action( 'init', array( 'WC_Shortcodes', 'init' ) );
|
||||
add_action( 'init', array( 'WC_Emails', 'init_transactional_emails' ) );
|
||||
add_action( 'init', array( $this, 'wpdb_table_fix' ), 0 );
|
||||
add_action( 'init', array( $this, 'add_image_sizes' ) );
|
||||
add_action( 'switch_blog', array( $this, 'wpdb_table_fix' ), 0 );
|
||||
}
|
||||
|
||||
|
@ -514,7 +515,6 @@ final class WooCommerce {
|
|||
$this->define( 'WC_TEMPLATE_PATH', $this->template_path() );
|
||||
|
||||
$this->add_thumbnail_support();
|
||||
$this->add_image_sizes();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -543,7 +543,7 @@ final class WooCommerce {
|
|||
*
|
||||
* @since 2.3
|
||||
*/
|
||||
private function add_image_sizes() {
|
||||
public function add_image_sizes() {
|
||||
$thumbnail = wc_get_image_size( 'thumbnail' );
|
||||
$single = wc_get_image_size( 'single' );
|
||||
|
||||
|
|
|
@ -157,6 +157,10 @@ class WC_CLI_REST_Command {
|
|||
$body = self::limit_item_to_fields( $body, $assoc_args['fields'] );
|
||||
}
|
||||
|
||||
if ( empty( $assoc_args['format'] ) ) {
|
||||
$assoc_args['format'] = 'table';
|
||||
}
|
||||
|
||||
if ( 'headers' === $assoc_args['format'] ) {
|
||||
echo json_encode( $headers );
|
||||
} elseif ( 'body' === $assoc_args['format'] ) {
|
||||
|
@ -201,6 +205,10 @@ class WC_CLI_REST_Command {
|
|||
}
|
||||
}
|
||||
|
||||
if ( empty( $assoc_args['format'] ) ) {
|
||||
$assoc_args['format'] = 'table';
|
||||
}
|
||||
|
||||
if ( ! empty( $assoc_args['format'] ) && 'count' === $assoc_args['format'] ) {
|
||||
echo (int) $headers['X-WP-Total'];
|
||||
} elseif ( 'headers' === $assoc_args['format'] ) {
|
||||
|
|
|
@ -73,6 +73,8 @@ class WC_Order_Data_Store_CPT extends Abstract_WC_Order_Data_Store_CPT implement
|
|||
'_shipping_address_index',
|
||||
'_recorded_sales',
|
||||
'_recorded_coupon_usage_counts',
|
||||
'_download_permissions_granted',
|
||||
'_order_stock_reduced',
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -54,7 +54,7 @@ class WC_Gateway_Cheque extends WC_Payment_Gateway {
|
|||
'title' => __( 'Enable/Disable', 'woocommerce' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable check payments', 'woocommerce' ),
|
||||
'default' => 'yes',
|
||||
'default' => 'no',
|
||||
),
|
||||
'title' => array(
|
||||
'title' => __( 'Title', 'woocommerce' ),
|
||||
|
|
|
@ -1,24 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Handles responses from PayPal IPN.
|
||||
*
|
||||
* @package WooCommerce/PayPal
|
||||
* @version 3.3.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
include_once( dirname( __FILE__ ) . '/class-wc-gateway-paypal-response.php' );
|
||||
require_once dirname( __FILE__ ) . '/class-wc-gateway-paypal-response.php';
|
||||
|
||||
/**
|
||||
* Handles responses from PayPal IPN.
|
||||
* WC_Gateway_Paypal_IPN_Handler class.
|
||||
*/
|
||||
class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
|
||||
|
||||
/** @var string Receiver email address to validate */
|
||||
/**
|
||||
* Receiver email address to validate.
|
||||
*
|
||||
* @var string Receiver email address.
|
||||
*/
|
||||
protected $receiver_email;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param bool $sandbox
|
||||
* @param string $receiver_email
|
||||
* @param bool $sandbox Use sandbox or not.
|
||||
* @param string $receiver_email Email to receive IPN from.
|
||||
*/
|
||||
public function __construct( $sandbox = false, $receiver_email = '' ) {
|
||||
add_action( 'woocommerce_api_wc_gateway_paypal', array( $this, 'check_response' ) );
|
||||
|
@ -32,8 +42,8 @@ class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
|
|||
* Check for PayPal IPN Response.
|
||||
*/
|
||||
public function check_response() {
|
||||
if ( ! empty( $_POST ) && $this->validate_ipn() ) {
|
||||
$posted = wp_unslash( $_POST );
|
||||
if ( ! empty( $_POST ) && $this->validate_ipn() ) { // WPCS: CSRF ok.
|
||||
$posted = wp_unslash( $_POST ); // WPCS: CSRF ok, input var ok.
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
do_action( 'valid-paypal-standard-ipn-request', $posted );
|
||||
|
@ -46,10 +56,13 @@ class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
|
|||
|
||||
/**
|
||||
* There was a valid response.
|
||||
* @param array $posted Post data after wp_unslash
|
||||
*
|
||||
* @param array $posted Post data after wp_unslash.
|
||||
*/
|
||||
public function valid_response( $posted ) {
|
||||
if ( ! empty( $posted['custom'] ) && ( $order = $this->get_paypal_order( $posted['custom'] ) ) ) {
|
||||
$order = ! empty( $posted['custom'] ) ? $this->get_paypal_order( $posted['custom'] ) : false;
|
||||
|
||||
if ( $order ) {
|
||||
|
||||
// Lowercase returned variables.
|
||||
$posted['payment_status'] = strtolower( $posted['payment_status'] );
|
||||
|
@ -69,11 +82,11 @@ class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
|
|||
public function validate_ipn() {
|
||||
WC_Gateway_Paypal::log( 'Checking IPN response is valid' );
|
||||
|
||||
// Get received values from post data
|
||||
$validate_ipn = wp_unslash( $_POST );
|
||||
// Get received values from post data.
|
||||
$validate_ipn = wp_unslash( $_POST ); // WPCS: CSRF ok, input var ok.
|
||||
$validate_ipn['cmd'] = '_notify-validate';
|
||||
|
||||
// Send back post vars to paypal
|
||||
// Send back post vars to paypal.
|
||||
$params = array(
|
||||
'body' => $validate_ipn,
|
||||
'timeout' => 60,
|
||||
|
@ -106,12 +119,13 @@ class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
|
|||
|
||||
/**
|
||||
* Check for a valid transaction type.
|
||||
* @param string $txn_type
|
||||
*
|
||||
* @param string $txn_type Transaction type.
|
||||
*/
|
||||
protected function validate_transaction_type( $txn_type ) {
|
||||
$accepted_types = array( 'cart', 'instant', 'express_checkout', 'web_accept', 'masspay', 'send_money', 'paypal_here' );
|
||||
|
||||
if ( ! in_array( strtolower( $txn_type ), $accepted_types ) ) {
|
||||
if ( ! in_array( strtolower( $txn_type ), $accepted_types, true ) ) {
|
||||
WC_Gateway_Paypal::log( 'Aborting, Invalid type:' . $txn_type );
|
||||
exit;
|
||||
}
|
||||
|
@ -119,14 +133,15 @@ class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
|
|||
|
||||
/**
|
||||
* Check currency from IPN matches the order.
|
||||
* @param WC_Order $order
|
||||
* @param string $currency
|
||||
*
|
||||
* @param WC_Order $order Order object.
|
||||
* @param string $currency Currency code.
|
||||
*/
|
||||
protected function validate_currency( $order, $currency ) {
|
||||
if ( $order->get_currency() != $currency ) {
|
||||
if ( $order->get_currency() !== $currency ) {
|
||||
WC_Gateway_Paypal::log( 'Payment error: Currencies do not match (sent "' . $order->get_currency() . '" | returned "' . $currency . '")' );
|
||||
|
||||
// Put this order on-hold for manual checking.
|
||||
/* translators: %s: currency code. */
|
||||
$order->update_status( 'on-hold', sprintf( __( 'Validation error: PayPal currencies do not match (code %s).', 'woocommerce' ), $currency ) );
|
||||
exit;
|
||||
}
|
||||
|
@ -134,14 +149,15 @@ class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
|
|||
|
||||
/**
|
||||
* Check payment amount from IPN matches the order.
|
||||
* @param WC_Order $order
|
||||
* @param int $amount
|
||||
*
|
||||
* @param WC_Order $order Order object.
|
||||
* @param int $amount Amount to validate.
|
||||
*/
|
||||
protected function validate_amount( $order, $amount ) {
|
||||
if ( number_format( $order->get_total(), 2, '.', '' ) != number_format( $amount, 2, '.', '' ) ) {
|
||||
if ( number_format( $order->get_total(), 2, '.', '' ) !== number_format( $amount, 2, '.', '' ) ) {
|
||||
WC_Gateway_Paypal::log( 'Payment error: Amounts do not match (gross ' . $amount . ')' );
|
||||
|
||||
// Put this order on-hold for manual checking.
|
||||
/* translators: %s: Amount. */
|
||||
$order->update_status( 'on-hold', sprintf( __( 'Validation error: PayPal amounts do not match (gross %s).', 'woocommerce' ), $amount ) );
|
||||
exit;
|
||||
}
|
||||
|
@ -150,14 +166,15 @@ class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
|
|||
/**
|
||||
* Check receiver email from PayPal. If the receiver email in the IPN is different than what is stored in.
|
||||
* WooCommerce -> Settings -> Checkout -> PayPal, it will log an error about it.
|
||||
* @param WC_Order $order
|
||||
* @param string $receiver_email
|
||||
*
|
||||
* @param WC_Order $order Order object.
|
||||
* @param string $receiver_email Email to validate.
|
||||
*/
|
||||
protected function validate_receiver_email( $order, $receiver_email ) {
|
||||
if ( strcasecmp( trim( $receiver_email ), trim( $this->receiver_email ) ) != 0 ) {
|
||||
if ( strcasecmp( trim( $receiver_email ), trim( $this->receiver_email ) ) !== 0 ) {
|
||||
WC_Gateway_Paypal::log( "IPN Response is for another account: {$receiver_email}. Your email is {$this->receiver_email}" );
|
||||
|
||||
// Put this order on-hold for manual checking.
|
||||
/* translators: %s: email address . */
|
||||
$order->update_status( 'on-hold', sprintf( __( 'Validation error: PayPal IPN response from a different email address (%s).', 'woocommerce' ), $receiver_email ) );
|
||||
exit;
|
||||
}
|
||||
|
@ -165,8 +182,9 @@ class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
|
|||
|
||||
/**
|
||||
* Handle a completed payment.
|
||||
* @param WC_Order $order
|
||||
* @param array $posted
|
||||
*
|
||||
* @param WC_Order $order Order object.
|
||||
* @param array $posted Posted data.
|
||||
*/
|
||||
protected function payment_status_completed( $order, $posted ) {
|
||||
if ( $order->has_status( wc_get_is_paid_statuses() ) ) {
|
||||
|
@ -195,6 +213,7 @@ class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
|
|||
if ( 'authorization' === $posted['pending_reason'] ) {
|
||||
$this->payment_on_hold( $order, __( 'Payment authorized. Change payment status to processing or complete to capture funds.', 'woocommerce' ) );
|
||||
} else {
|
||||
/* translators: %s: pending reason. */
|
||||
$this->payment_on_hold( $order, sprintf( __( 'Payment pending (%s).', 'woocommerce' ), $posted['pending_reason'] ) );
|
||||
}
|
||||
}
|
||||
|
@ -202,8 +221,9 @@ class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
|
|||
|
||||
/**
|
||||
* Handle a pending payment.
|
||||
* @param WC_Order $order
|
||||
* @param array $posted
|
||||
*
|
||||
* @param WC_Order $order Order object.
|
||||
* @param array $posted Posted data.
|
||||
*/
|
||||
protected function payment_status_pending( $order, $posted ) {
|
||||
$this->payment_status_completed( $order, $posted );
|
||||
|
@ -211,17 +231,20 @@ class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
|
|||
|
||||
/**
|
||||
* Handle a failed payment.
|
||||
* @param WC_Order $order
|
||||
* @param array $posted
|
||||
*
|
||||
* @param WC_Order $order Order object.
|
||||
* @param array $posted Posted data.
|
||||
*/
|
||||
protected function payment_status_failed( $order, $posted ) {
|
||||
/* translators: %s: payment status. */
|
||||
$order->update_status( 'failed', sprintf( __( 'Payment %s via IPN.', 'woocommerce' ), wc_clean( $posted['payment_status'] ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a denied payment.
|
||||
* @param WC_Order $order
|
||||
* @param array $posted
|
||||
*
|
||||
* @param WC_Order $order Order object.
|
||||
* @param array $posted Posted data.
|
||||
*/
|
||||
protected function payment_status_denied( $order, $posted ) {
|
||||
$this->payment_status_failed( $order, $posted );
|
||||
|
@ -229,8 +252,9 @@ class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
|
|||
|
||||
/**
|
||||
* Handle an expired payment.
|
||||
* @param WC_Order $order
|
||||
* @param array $posted
|
||||
*
|
||||
* @param WC_Order $order Order object.
|
||||
* @param array $posted Posted data.
|
||||
*/
|
||||
protected function payment_status_expired( $order, $posted ) {
|
||||
$this->payment_status_failed( $order, $posted );
|
||||
|
@ -238,8 +262,9 @@ class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
|
|||
|
||||
/**
|
||||
* Handle a voided payment.
|
||||
* @param WC_Order $order
|
||||
* @param array $posted
|
||||
*
|
||||
* @param WC_Order $order Order object.
|
||||
* @param array $posted Posted data.
|
||||
*/
|
||||
protected function payment_status_voided( $order, $posted ) {
|
||||
$this->payment_status_failed( $order, $posted );
|
||||
|
@ -248,30 +273,35 @@ class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
|
|||
/**
|
||||
* When a user cancelled order is marked paid.
|
||||
*
|
||||
* @param WC_Order $order
|
||||
* @param array $posted
|
||||
* @param WC_Order $order Order object.
|
||||
* @param array $posted Posted data.
|
||||
*/
|
||||
protected function payment_status_paid_cancelled_order( $order, $posted ) {
|
||||
$this->send_ipn_email_notification(
|
||||
sprintf( __( 'Payment for cancelled order %s received', 'woocommerce' ), '<a class="link" href="' . esc_url( admin_url( 'post.php?post=' . $order->get_id() . '&action=edit' ) ) . '">' . $order->get_order_number() . '</a>' ),
|
||||
sprintf( __( 'Order #%1$s has been marked paid by PayPal IPN, but was previously cancelled. Admin handling required.', 'woocommerce' ), $order->get_order_number() )
|
||||
/* translators: %s: order link. */
|
||||
sprintf( __( 'Payment for cancelled order %s received', 'woocommerce' ), '<a class="link" href="' . esc_url( $order->get_edit_order_url() ) . '">' . $order->get_order_number() . '</a>' ),
|
||||
/* translators: %s: order ID. */
|
||||
sprintf( __( 'Order #%s has been marked paid by PayPal IPN, but was previously cancelled. Admin handling required.', 'woocommerce' ), $order->get_order_number() )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a refunded order.
|
||||
* @param WC_Order $order
|
||||
* @param array $posted
|
||||
*
|
||||
* @param WC_Order $order Order object.
|
||||
* @param array $posted Posted data.
|
||||
*/
|
||||
protected function payment_status_refunded( $order, $posted ) {
|
||||
// Only handle full refunds, not partial.
|
||||
if ( $order->get_total() == ( $posted['mc_gross'] * -1 ) ) {
|
||||
if ( $order->get_total() === wc_format_decimal( $posted['mc_gross'] * -1 ) ) {
|
||||
|
||||
// Mark order as refunded.
|
||||
/* translators: %s: payment status. */
|
||||
$order->update_status( 'refunded', sprintf( __( 'Payment %s via IPN.', 'woocommerce' ), strtolower( $posted['payment_status'] ) ) );
|
||||
|
||||
$this->send_ipn_email_notification(
|
||||
sprintf( __( 'Payment for order %s refunded', 'woocommerce' ), '<a class="link" href="' . esc_url( admin_url( 'post.php?post=' . $order->get_id() . '&action=edit' ) ) . '">' . $order->get_order_number() . '</a>' ),
|
||||
/* translators: %s: order link. */
|
||||
sprintf( __( 'Payment for order %s refunded', 'woocommerce' ), '<a class="link" href="' . esc_url( $order->get_edit_order_url() ) . '">' . $order->get_order_number() . '</a>' ),
|
||||
/* translators: %1$s: order ID, %2$s: reason code. */
|
||||
sprintf( __( 'Order #%1$s has been marked as refunded - PayPal reason code: %2$s', 'woocommerce' ), $order->get_order_number(), $posted['reason_code'] )
|
||||
);
|
||||
}
|
||||
|
@ -279,34 +309,42 @@ class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
|
|||
|
||||
/**
|
||||
* Handle a reversal.
|
||||
* @param WC_Order $order
|
||||
* @param array $posted
|
||||
*
|
||||
* @param WC_Order $order Order object.
|
||||
* @param array $posted Posted data.
|
||||
*/
|
||||
protected function payment_status_reversed( $order, $posted ) {
|
||||
/* translators: %s: payment status. */
|
||||
$order->update_status( 'on-hold', sprintf( __( 'Payment %s via IPN.', 'woocommerce' ), wc_clean( $posted['payment_status'] ) ) );
|
||||
|
||||
$this->send_ipn_email_notification(
|
||||
sprintf( __( 'Payment for order %s reversed', 'woocommerce' ), '<a class="link" href="' . esc_url( admin_url( 'post.php?post=' . $order->get_id() . '&action=edit' ) ) . '">' . $order->get_order_number() . '</a>' ),
|
||||
/* translators: %s: order link. */
|
||||
sprintf( __( 'Payment for order %s reversed', 'woocommerce' ), '<a class="link" href="' . esc_url( $order->get_edit_order_url() ) . '">' . $order->get_order_number() . '</a>' ),
|
||||
/* translators: %1$s: order ID, %2$s: reason code. */
|
||||
sprintf( __( 'Order #%1$s has been marked on-hold due to a reversal - PayPal reason code: %2$s', 'woocommerce' ), $order->get_order_number(), wc_clean( $posted['reason_code'] ) )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a cancelled reversal.
|
||||
* @param WC_Order $order
|
||||
* @param array $posted
|
||||
*
|
||||
* @param WC_Order $order Order object.
|
||||
* @param array $posted Posted data.
|
||||
*/
|
||||
protected function payment_status_canceled_reversal( $order, $posted ) {
|
||||
$this->send_ipn_email_notification(
|
||||
/* translators: %s: order link. */
|
||||
sprintf( __( 'Reversal cancelled for order #%s', 'woocommerce' ), $order->get_order_number() ),
|
||||
sprintf( __( 'Order #%1$s has had a reversal cancelled. Please check the status of payment and update the order status accordingly here: %2$s', 'woocommerce' ), $order->get_order_number(), esc_url( admin_url( 'post.php?post=' . $order->get_id() . '&action=edit' ) ) )
|
||||
/* translators: %1$s: order ID, %2$s: order link. */
|
||||
sprintf( __( 'Order #%1$s has had a reversal cancelled. Please check the status of payment and update the order status accordingly here: %2$s', 'woocommerce' ), $order->get_order_number(), esc_url( $order->get_edit_order_url() ) )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save important data from the IPN to the order.
|
||||
* @param WC_Order $order
|
||||
* @param array $posted
|
||||
*
|
||||
* @param WC_Order $order Order object.
|
||||
* @param array $posted Posted data.
|
||||
*/
|
||||
protected function save_paypal_meta_data( $order, $posted ) {
|
||||
if ( ! empty( $posted['payer_email'] ) ) {
|
||||
|
@ -331,15 +369,16 @@ class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
|
|||
|
||||
/**
|
||||
* Send a notification to the user handling orders.
|
||||
* @param string $subject
|
||||
* @param string $message
|
||||
*
|
||||
* @param string $subject Email subject.
|
||||
* @param string $message Email message.
|
||||
*/
|
||||
protected function send_ipn_email_notification( $subject, $message ) {
|
||||
$new_order_settings = get_option( 'woocommerce_new_order_settings', array() );
|
||||
$mailer = WC()->mailer();
|
||||
$message = $mailer->wrap_message( $subject, $message );
|
||||
|
||||
$woocommerce_paypal_settings = get_option('woocommerce_paypal_settings');
|
||||
$woocommerce_paypal_settings = get_option( 'woocommerce_paypal_settings' );
|
||||
if ( ! empty( $woocommerce_paypal_settings['ipn_notification'] ) && 'no' === $woocommerce_paypal_settings['ipn_notification'] ) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ return array(
|
|||
'title' => __( 'Enable/Disable', 'woocommerce' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable PayPal Standard', 'woocommerce' ),
|
||||
'default' => 'yes',
|
||||
'default' => 'no',
|
||||
),
|
||||
'title' => array(
|
||||
'title' => __( 'Title', 'woocommerce' ),
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
/**
|
||||
* WooCommerce Product CSV importer
|
||||
*
|
||||
* @author Automattic
|
||||
* @category Admin
|
||||
* @package WooCommerce/Import
|
||||
* @version 3.1.0
|
||||
*/
|
||||
|
@ -16,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
* Include dependencies.
|
||||
*/
|
||||
if ( ! class_exists( 'WC_Product_Importer', false ) ) {
|
||||
include_once( dirname( __FILE__ ) . '/abstract-wc-product-importer.php' );
|
||||
include_once dirname( __FILE__ ) . '/abstract-wc-product-importer.php';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,7 +55,9 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
* Read file.
|
||||
*/
|
||||
protected function read_file() {
|
||||
if ( false !== ( $handle = fopen( $this->file, 'r' ) ) ) {
|
||||
$handle = fopen( $this->file, 'r' ); // @codingStandardsIgnoreLine.
|
||||
|
||||
if ( false !== $handle ) {
|
||||
$this->raw_keys = fgetcsv( $handle, 0, $this->params['delimiter'], $this->params['enclosure'] );
|
||||
|
||||
// Remove BOM signature from the first item.
|
||||
|
@ -69,11 +69,17 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
fseek( $handle, (int) $this->params['start_pos'] );
|
||||
}
|
||||
|
||||
while ( false !== ( $row = fgetcsv( $handle, 0, $this->params['delimiter'], $this->params['enclosure'] ) ) ) {
|
||||
$this->raw_data[] = $row;
|
||||
$this->file_positions[ count( $this->raw_data ) ] = ftell( $handle );
|
||||
while ( 1 ) {
|
||||
$row = fgetcsv( $handle, 0, $this->params['delimiter'], $this->params['enclosure'] );
|
||||
|
||||
if ( ( $this->params['end_pos'] > 0 && ftell( $handle ) >= $this->params['end_pos'] ) || 0 === --$this->params['lines'] ) {
|
||||
if ( false !== $row ) {
|
||||
$this->raw_data[] = $row;
|
||||
$this->file_positions[ count( $this->raw_data ) ] = ftell( $handle );
|
||||
|
||||
if ( ( $this->params['end_pos'] > 0 && ftell( $handle ) >= $this->params['end_pos'] ) || 0 === --$this->params['lines'] ) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -141,14 +147,14 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
$id = intval( $matches[1] );
|
||||
|
||||
// If original_id is found, use that instead of the given ID since a new placeholder must have been created already.
|
||||
$original_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_original_id' AND meta_value = %s;", $id ) );
|
||||
$original_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_original_id' AND meta_value = %s;", $id ) ); // WPCS: db call ok, cache ok.
|
||||
|
||||
if ( $original_id ) {
|
||||
return absint( $original_id );
|
||||
}
|
||||
|
||||
// See if the given ID maps to a valid product allready.
|
||||
$existing_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_type IN ( 'product', 'product_variation' ) AND ID = %d;", $id ) );
|
||||
$existing_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_type IN ( 'product', 'product_variation' ) AND ID = %d;", $id ) ); // WPCS: db call ok, cache ok.
|
||||
|
||||
if ( $existing_id ) {
|
||||
return absint( $existing_id );
|
||||
|
@ -166,7 +172,9 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
return $id;
|
||||
}
|
||||
|
||||
if ( $id = wc_get_product_id_by_sku( $value ) ) {
|
||||
$id = wc_get_product_id_by_sku( $value );
|
||||
|
||||
if ( $id ) {
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
@ -206,7 +214,7 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
}
|
||||
|
||||
// See if this maps to an ID placeholder already.
|
||||
$original_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_original_id' AND meta_value = %s;", $id ) );
|
||||
$original_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_original_id' AND meta_value = %s;", $id ) ); // WPCS: db call ok, cache ok.
|
||||
|
||||
if ( $original_id ) {
|
||||
return absint( $original_id );
|
||||
|
@ -214,8 +222,10 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
|
||||
// Not updating? Make sure we have a new placeholder for this ID.
|
||||
if ( ! $this->params['update_existing'] ) {
|
||||
$id = isset( $this->raw_data['sku'] ) ? wc_get_product_id_by_sku( $this->raw_data['sku'] ) : '';
|
||||
|
||||
// If row has a SKU, make sure placeholder was not made already.
|
||||
if ( isset( $this->raw_data['sku'] ) && $id = wc_get_product_id_by_sku( $this->raw_data['sku'] ) ) {
|
||||
if ( $id ) {
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
@ -344,7 +354,7 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
if ( is_array( $term ) ) {
|
||||
$term_id = $term['term_id'];
|
||||
} else {
|
||||
$term = wp_insert_term( $_term, 'product_cat', array( 'parent' => intval( $parent ) ) );
|
||||
$term = wp_insert_term( $_term, 'product_cat', array( 'parent' => intval( $parent ) ) );
|
||||
|
||||
if ( is_wp_error( $term ) ) {
|
||||
break; // We cannot continue if the term cannot be inserted.
|
||||
|
@ -557,8 +567,8 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
'grouped_products' => array( $this, 'parse_relative_comma_field' ),
|
||||
'upsell_ids' => array( $this, 'parse_relative_comma_field' ),
|
||||
'cross_sell_ids' => array( $this, 'parse_relative_comma_field' ),
|
||||
'download_limit' => 'absint',
|
||||
'download_expiry' => 'absint',
|
||||
'download_limit' => 'intval',
|
||||
'download_expiry' => 'intval',
|
||||
'product_url' => 'esc_url_raw',
|
||||
'menu_order' => 'intval',
|
||||
);
|
||||
|
@ -640,7 +650,7 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
|
||||
// Status is mapped from a special published field.
|
||||
if ( isset( $data['published'] ) ) {
|
||||
$statuses = array(
|
||||
$statuses = array(
|
||||
-1 => 'draft',
|
||||
0 => 'private',
|
||||
1 => 'publish',
|
||||
|
@ -817,9 +827,11 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
$row_data[] = $name;
|
||||
}
|
||||
if ( $id ) {
|
||||
/* translators: %d: product ID */
|
||||
$row_data[] = sprintf( __( 'ID %d', 'woocommerce' ), $id );
|
||||
}
|
||||
if ( $sku ) {
|
||||
/* translators: %s: product SKU */
|
||||
$row_data[] = sprintf( __( 'SKU %s', 'woocommerce' ), $sku );
|
||||
}
|
||||
|
||||
|
@ -840,10 +852,10 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
$index = 0;
|
||||
$update_existing = $this->params['update_existing'];
|
||||
$data = array(
|
||||
'imported' => array(),
|
||||
'failed' => array(),
|
||||
'updated' => array(),
|
||||
'skipped' => array(),
|
||||
'imported' => array(),
|
||||
'failed' => array(),
|
||||
'updated' => array(),
|
||||
'skipped' => array(),
|
||||
);
|
||||
|
||||
foreach ( $this->parsed_data as $parsed_data_key => $parsed_data ) {
|
||||
|
@ -857,23 +869,34 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
if ( $id ) {
|
||||
$product = wc_get_product( $id );
|
||||
$id_exists = $product && 'importing' !== $product->get_status();
|
||||
} elseif ( $sku && ( $id_from_sku = wc_get_product_id_by_sku( $sku ) ) ) {
|
||||
$product = wc_get_product( $id_from_sku );
|
||||
$sku_exists = $product && 'importing' !== $product->get_status();
|
||||
} elseif ( $sku ) {
|
||||
$id_from_sku = wc_get_product_id_by_sku( $sku );
|
||||
$product = $id_from_sku ? wc_get_product( $id_from_sku ) : false;
|
||||
$sku_exists = $product && 'importing' !== $product->get_status();
|
||||
}
|
||||
|
||||
if ( $id_exists && ! $update_existing ) {
|
||||
$data['skipped'][] = new WP_Error( 'woocommerce_product_importer_error', __( 'A product with this ID already exists.', 'woocommerce' ), array( 'id' => $id, 'row' => $this->get_row_id( $parsed_data ) ) );
|
||||
$data['skipped'][] = new WP_Error( 'woocommerce_product_importer_error', __( 'A product with this ID already exists.', 'woocommerce' ), array(
|
||||
'id' => $id,
|
||||
'row' => $this->get_row_id( $parsed_data ),
|
||||
) );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $sku_exists && ! $update_existing ) {
|
||||
$data['skipped'][] = new WP_Error( 'woocommerce_product_importer_error', __( 'A product with this SKU already exists.', 'woocommerce' ), array( 'sku' => $sku, 'row' => $this->get_row_id( $parsed_data ) ) );
|
||||
$data['skipped'][] = new WP_Error( 'woocommerce_product_importer_error', __( 'A product with this SKU already exists.', 'woocommerce' ), array(
|
||||
'sku' => $sku,
|
||||
'row' => $this->get_row_id( $parsed_data ),
|
||||
) );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $update_existing && ( $id || $sku ) && ! $id_exists && ! $sku_exists ) {
|
||||
$data['skipped'][] = new WP_Error( 'woocommerce_product_importer_error', __( 'No matching product exists to update.', 'woocommerce' ), array( 'id' => $id, 'sku' => $sku, 'row' => $this->get_row_id( $parsed_data ) ) );
|
||||
$data['skipped'][] = new WP_Error( 'woocommerce_product_importer_error', __( 'No matching product exists to update.', 'woocommerce' ), array(
|
||||
'id' => $id,
|
||||
'sku' => $sku,
|
||||
'row' => $this->get_row_id( $parsed_data ),
|
||||
) );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -881,9 +904,9 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
|
||||
if ( is_wp_error( $result ) ) {
|
||||
$result->add_data( array( 'row' => $this->get_row_id( $parsed_data ) ) );
|
||||
$data['failed'][] = $result;
|
||||
$data['failed'][] = $result;
|
||||
} elseif ( $result['updated'] ) {
|
||||
$data['updated'][] = $result['id'];
|
||||
$data['updated'][] = $result['id'];
|
||||
} else {
|
||||
$data['imported'][] = $result['id'];
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ class WC_Shortcode_Checkout {
|
|||
if ( $item && is_callable( array( $item, 'get_product' ) ) ) {
|
||||
$product = $item->get_product();
|
||||
|
||||
if ( $product && ! $product->is_in_stock() ) {
|
||||
if ( $product && ! apply_filters( 'woocommerce_pay_order_product_in_stock', $product->is_in_stock(), $product, $order ) ) {
|
||||
/* translators: %s: product name */
|
||||
throw new Exception( sprintf( __( 'Sorry, "%s" is no longer in stock so this order cannot be paid for. We apologize for any inconvenience caused.', 'woocommerce' ), $product->get_name() ) );
|
||||
}
|
||||
|
|
|
@ -455,16 +455,16 @@ function get_woocommerce_price_format() {
|
|||
|
||||
switch ( $currency_pos ) {
|
||||
case 'left' :
|
||||
$format = '%1$s‎%2$s';
|
||||
$format = '%1$s%2$s';
|
||||
break;
|
||||
case 'right' :
|
||||
$format = '%2$s%1$s‏';
|
||||
$format = '%2$s%1$s';
|
||||
break;
|
||||
case 'left_space' :
|
||||
$format = '%1$s‎ %2$s';
|
||||
$format = '%1$s %2$s';
|
||||
break;
|
||||
case 'right_space' :
|
||||
$format = '%2$s %1$s‏';
|
||||
$format = '%2$s %1$s';
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,22 +4,20 @@
|
|||
*
|
||||
* Functions for error/message handling and display.
|
||||
*
|
||||
* @author WooThemes
|
||||
* @category Core
|
||||
* @package WooCommerce/Functions
|
||||
* @version 2.1.0
|
||||
* @package WooCommerce/Functions
|
||||
* @version 2.1.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the count of notices added, either for all notices (default) or for one.
|
||||
* particular notice type specified by $notice_type.
|
||||
*
|
||||
* @since 2.1
|
||||
* @param string $notice_type The name of the notice type - either error, success or notice. [optional]
|
||||
* @since 2.1
|
||||
* @param string $notice_type Optional. The name of the notice type - either error, success or notice.
|
||||
* @return int
|
||||
*/
|
||||
function wc_notice_count( $notice_type = '' ) {
|
||||
|
@ -33,12 +31,12 @@ function wc_notice_count( $notice_type = '' ) {
|
|||
|
||||
if ( isset( $all_notices[ $notice_type ] ) ) {
|
||||
|
||||
$notice_count = absint( sizeof( $all_notices[ $notice_type ] ) );
|
||||
$notice_count = count( $all_notices[ $notice_type ] );
|
||||
|
||||
} elseif ( empty( $notice_type ) ) {
|
||||
|
||||
foreach ( $all_notices as $notices ) {
|
||||
$notice_count += absint( sizeof( $all_notices ) );
|
||||
$notice_count += count( $notices );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,9 +46,9 @@ function wc_notice_count( $notice_type = '' ) {
|
|||
/**
|
||||
* Check if a notice has already been added.
|
||||
*
|
||||
* @since 2.1
|
||||
* @param string $message The text to display in the notice.
|
||||
* @param string $notice_type The singular name of the notice type - either error, success or notice. [optional]
|
||||
* @since 2.1
|
||||
* @param string $message The text to display in the notice.
|
||||
* @param string $notice_type Optional. The name of the notice type - either error, success or notice.
|
||||
* @return bool
|
||||
*/
|
||||
function wc_has_notice( $message, $notice_type = 'success' ) {
|
||||
|
@ -61,7 +59,7 @@ function wc_has_notice( $message, $notice_type = 'success' ) {
|
|||
|
||||
$notices = WC()->session->get( 'wc_notices', array() );
|
||||
$notices = isset( $notices[ $notice_type ] ) ? $notices[ $notice_type ] : array();
|
||||
return array_search( $message, $notices ) !== false;
|
||||
return array_search( $message, $notices, true ) !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,7 +67,7 @@ function wc_has_notice( $message, $notice_type = 'success' ) {
|
|||
*
|
||||
* @since 2.1
|
||||
* @param string $message The text to display in the notice.
|
||||
* @param string $notice_type The singular name of the notice type - either error, success or notice. [optional]
|
||||
* @param string $notice_type Optional. The name of the notice type - either error, success or notice.
|
||||
*/
|
||||
function wc_add_notice( $message, $notice_type = 'success' ) {
|
||||
if ( ! did_action( 'woocommerce_init' ) ) {
|
||||
|
@ -79,7 +77,7 @@ function wc_add_notice( $message, $notice_type = 'success' ) {
|
|||
|
||||
$notices = WC()->session->get( 'wc_notices', array() );
|
||||
|
||||
// Backward compatibility
|
||||
// Backward compatibility.
|
||||
if ( 'success' === $notice_type ) {
|
||||
$message = apply_filters( 'woocommerce_add_message', $message );
|
||||
}
|
||||
|
@ -91,9 +89,9 @@ function wc_add_notice( $message, $notice_type = 'success' ) {
|
|||
|
||||
/**
|
||||
* Set all notices at once.
|
||||
* @since 2.6.0
|
||||
*
|
||||
* @param mixed $notices
|
||||
* @since 2.6.0
|
||||
* @param mixed $notices Array of notices.
|
||||
*/
|
||||
function wc_set_notices( $notices ) {
|
||||
if ( ! did_action( 'woocommerce_init' ) ) {
|
||||
|
@ -150,7 +148,7 @@ add_action( 'woocommerce_before_single_product', 'wc_print_notices', 10 );
|
|||
*
|
||||
* @since 2.1
|
||||
* @param string $message The text to display in the notice.
|
||||
* @param string $notice_type The singular name of the notice type - either error, success or notice. [optional]
|
||||
* @param string $notice_type Optional. The singular name of the notice type - either error, success or notice.
|
||||
*/
|
||||
function wc_print_notice( $message, $notice_type = 'success' ) {
|
||||
if ( 'success' === $notice_type ) {
|
||||
|
@ -165,8 +163,8 @@ function wc_print_notice( $message, $notice_type = 'success' ) {
|
|||
/**
|
||||
* Returns all queued notices, optionally filtered by a notice type.
|
||||
*
|
||||
* @since 2.1
|
||||
* @param string $notice_type The singular name of the notice type - either error, success or notice. [optional]
|
||||
* @since 2.1
|
||||
* @param string $notice_type Optional. The singular name of the notice type - either error, success or notice.
|
||||
* @return array|mixed
|
||||
*/
|
||||
function wc_get_notices( $notice_type = '' ) {
|
||||
|
@ -190,7 +188,8 @@ function wc_get_notices( $notice_type = '' ) {
|
|||
|
||||
/**
|
||||
* Add notices for WP Errors.
|
||||
* @param WP_Error $errors
|
||||
*
|
||||
* @param WP_Error $errors Errors.
|
||||
*/
|
||||
function wc_add_wp_error_notices( $errors ) {
|
||||
if ( is_wp_error( $errors ) && $errors->get_error_messages() ) {
|
||||
|
|
|
@ -1595,3 +1595,21 @@ function wc_update_330_clear_transients() {
|
|||
delete_transient( 'wc_addons_sections' );
|
||||
delete_transient( 'wc_addons_featured' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set PayPal's sandbox credentials.
|
||||
*/
|
||||
function wc_update_330_set_paypal_sandbox_credentials() {
|
||||
|
||||
$paypal_settings = get_option( 'woocommerce_paypal_settings' );
|
||||
|
||||
if ( isset( $paypal_settings['testmode'] ) && 'yes' === $paypal_settings['testmode'] ) {
|
||||
foreach ( array( 'api_username', 'api_password', 'api_signature' ) as $credential ) {
|
||||
if ( ! empty( $paypal_settings[ $credential ] ) ) {
|
||||
$paypal_settings[ 'sandbox_' . $credential ] = $paypal_settings[ $credential ];
|
||||
}
|
||||
}
|
||||
|
||||
update_option( 'woocommerce_paypal_settings', $paypal_settings );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -603,24 +603,12 @@ function wc_get_customer_saved_methods_list( $customer_id ) {
|
|||
*
|
||||
* @since 2.6.0
|
||||
* @param int $customer_id Customer ID.
|
||||
* @return WC_Order Order object if successful or false.
|
||||
* @return WC_Order|bool Order object if successful or false.
|
||||
*/
|
||||
function wc_get_customer_last_order( $customer_id ) {
|
||||
global $wpdb;
|
||||
$customer = new WC_Customer( $customer_id );
|
||||
|
||||
$customer_id = absint( $customer_id );
|
||||
|
||||
$id = $wpdb->get_var( "SELECT id
|
||||
FROM $wpdb->posts AS posts
|
||||
LEFT JOIN {$wpdb->postmeta} AS meta on posts.ID = meta.post_id
|
||||
WHERE meta.meta_key = '_customer_user'
|
||||
AND meta.meta_value = {$customer_id}
|
||||
AND posts.post_type = 'shop_order'
|
||||
AND posts.post_status IN ( '" . implode( "','", array_keys( wc_get_order_statuses() ) ) . "' )
|
||||
ORDER BY posts.ID DESC
|
||||
" );
|
||||
|
||||
return wc_get_order( $id );
|
||||
return $customer->get_last_order();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
"istanbul": "^1.0.0-alpha",
|
||||
"mocha": "^3.0.2",
|
||||
"stylelint": "~8.2.0",
|
||||
"wc-e2e-page-objects": "0.6.0"
|
||||
"wc-e2e-page-objects": "0.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.9.3",
|
||||
|
|
16
phpcs.xml
16
phpcs.xml
|
@ -21,7 +21,10 @@
|
|||
|
||||
<!-- Rules -->
|
||||
<rule ref="WooCommerce-Core" />
|
||||
<rule ref="PHPCompatibility" />
|
||||
<rule ref="PHPCompatibility">
|
||||
<exclude name="PHPCompatibility.PHP.NewKeywords.t_namespaceFound" />
|
||||
<exclude-pattern>tests/</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<rule ref="WordPress">
|
||||
<exclude name="WordPress.VIP.DirectDatabaseQuery.NoCaching" />
|
||||
|
@ -49,5 +52,16 @@
|
|||
</rule>
|
||||
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
|
||||
<exclude-pattern>includes/**/abstract-*.php</exclude-pattern>
|
||||
<exclude-pattern>tests/</exclude-pattern>
|
||||
</rule>
|
||||
<rule ref="Generic.Commenting">
|
||||
<exclude-pattern>tests/</exclude-pattern>
|
||||
</rule>
|
||||
<rule ref="Squiz.Commenting">
|
||||
<exclude-pattern>tests/</exclude-pattern>
|
||||
<exclude name="Squiz.Commenting.LongConditionClosingComment" />
|
||||
</rule>
|
||||
<rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine">
|
||||
<exclude-pattern>tests/e2e-tests/</exclude-pattern>
|
||||
</rule>
|
||||
</ruleset>
|
||||
|
|
37
readme.txt
37
readme.txt
|
@ -3,7 +3,7 @@ Contributors: automattic, mikejolley, jameskoster, claudiosanches, jshreve, code
|
|||
Tags: ecommerce, e-commerce, store, sales, sell, shop, cart, checkout, downloadable, downloads, paypal, storefront, woo commerce
|
||||
Requires at least: 4.7
|
||||
Tested up to: 4.9
|
||||
Stable tag: 3.2.0
|
||||
Stable tag: 3.2.6
|
||||
License: GPLv3
|
||||
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
|
@ -35,7 +35,7 @@ One of the biggest risks of using a hosted eCommerce platform is what happens to
|
|||
|
||||
= Define your style with Storefront =
|
||||
|
||||
[Storefront](https://wordpress.org/themes/storefront/) is a free WordPress theme available to any WooCommerce store. Along with deep WooCommerce integration, Storefront prioritizes speed and uptime while eliminating theme and plugin conflicts during major updates.
|
||||
[Storefront](https://woocommerce.com/storefront/) is a free WordPress theme available to any WooCommerce store. Along with deep WooCommerce integration, Storefront prioritizes speed and uptime while eliminating theme and plugin conflicts during major updates.
|
||||
|
||||
Define your style even further by customizing Storefront to your liking or choosing from one of our several [Storefront child themes](https://woocommerce.com/product-category/themes/storefront-child-theme-themes/). It’s all up to you, and all open source.
|
||||
|
||||
|
@ -76,7 +76,7 @@ And there’s plenty more where they came from. Visit our [extensions page](http
|
|||
|
||||
= Join our growing community =
|
||||
|
||||
When you download WooCommerce, you join a community of more than a million store owners, developers, and WordPress enthusiasts. We’re one of the fastest-growing open source communities online, and whether you’re a n00b or a Ninja, we’d love to have you!
|
||||
When you download WooCommerce, you join a community of more than a million store owners, developers, and WordPress enthusiasts. We're one of the fastest-growing open source communities online, and no matter your skill level we'd love to have you!
|
||||
|
||||
If you’re interested in contributing to WooCommerce we’ve got more than 350 contributors, and there’s always room for more. Head over to the [WooCommerce GitHub Repository](https://github.com/woocommerce/woocommerce) to find out how you can pitch in.
|
||||
|
||||
|
@ -112,9 +112,9 @@ Automatic updates should work like a charm; as always though, ensure you backup
|
|||
|
||||
If on the off-chance you do encounter issues with the shop/category pages after an update you simply need to flush the permalinks by going to WordPress > Settings > Permalinks and hitting 'save'. That should return things to normal.
|
||||
|
||||
= Dummy data =
|
||||
= Sample data =
|
||||
|
||||
WooCommerce comes with some dummy data you can use to see how products look; either import dummy_data.xml via the [WordPress importer](https://wordpress.org/plugins/wordpress-importer/) or use our [CSV Import Suite plugin](https://woocommerce.com/products/product-csv-import-suite/) to import dummy_data.csv and dummy_data_variations.csv.
|
||||
WooCommerce comes with some sample data you can use to see how products look; import sample_products.xml via the [WordPress importer](https://wordpress.org/plugins/wordpress-importer/). You can also use the core [CSV importer](https://docs.woocommerce.com/document/product-csv-importer-exporter/) or our [CSV Import Suite plugin](https://woocommerce.com/products/product-csv-import-suite/) to import sample_products.csv.
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
|
@ -170,15 +170,24 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woocommerce/wo
|
|||
* Feature - Changing image sizes will trigger automatic thumbnail regeneration in the background.
|
||||
* Feature - Improved how downloads are stored within products, and added new reporting/logging features to track who downloaded what, when.
|
||||
* Feature - Improved the overall appearance of the backend orders list, and added a new 'preview' button to quickly see order details.
|
||||
* Feature - New default dummy data and placeholders.
|
||||
* Feature - New default sample data and placeholders.
|
||||
* Feature - Added sandbox and live API details to the PayPal standard data, as well as an indication on the checkout to what mode is currently active. PayPal IPN email notifications are also now optional.
|
||||
* Feature - Introduced product category threshold filter (`woocommerce_product_category_filter_threshold`). AJAX powered select will kick in when you have over 100 categories.
|
||||
* Feature - Added `add_to_cart_description` method and aria-labels to cart buttons in the loop for accessibility.
|
||||
* Feature - Ability to search in logs when the database logger is used.
|
||||
* Performance - Adjusted how permalinks are retrieved and saved to avoid switching locales on each page load.
|
||||
* Performance - Added cache when loading product variation attributes.
|
||||
* Fix - Fix wc_notice_count logic.
|
||||
* Fix - Correct bulk edit price formatting.
|
||||
* Fix - Ajax add-to-cart button shortcode fix for variations.
|
||||
* Tweak - Update billing if account form changes.
|
||||
* Tweak - Remove videos from help sections.
|
||||
* Tweak - Preserve seconds when saving order date.
|
||||
* Tweak - Allow quantities less than 1, but not 0, in admin.
|
||||
* Tweak - Post types with no archives should not show in breadcrumb.
|
||||
* Tweak - Only load session handler class on frontend not during cron.
|
||||
* Tweak - Moved the 'Store Notice" option into the customizer.
|
||||
* Tweak - Checkout Postcode / Zip validation error message was missing Billing / Shipping Identification.
|
||||
* Tweak - Checkout Postcode / Zip validation error message was missing Billing / Shipping Identification.
|
||||
* Tweak - Added Iris color picker validation.
|
||||
* Tweak - Use scrollIntoView on checkout.
|
||||
* Tweak - Converted input submit elements to button submit elements across the entire codebase for consistency.
|
||||
|
@ -194,18 +203,19 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woocommerce/wo
|
|||
* Tweak - Let wp_signon handle email to username conversion.
|
||||
* Tweak - Made email field wider on checkout.
|
||||
* Tweak - Post entire shipping selection when showing multiple packages.
|
||||
* Dev - REST API - Orders should be created for users who exist on the site only.
|
||||
* Dev - REST API - Fixed default value of "dp" on orders and refunds endpoints.
|
||||
* Dev - Theming - Added theme support variables to declare image sizes used for products.
|
||||
* Dev - Theming - Added support for single-product-postname.php template files.
|
||||
* Dev - Added actions before calculations order totals and taxes and is_vat_excempt support.
|
||||
* Dev - Add filter 'woocommerce_coupon_get_apply_quantity'.
|
||||
* Dev - Grouped products; added filters to allow custom columns and changes to values.
|
||||
* Dev - Allow for cloning the WC_Cart object
|
||||
* Dev - Apply filters to registration-error-email-exists error.
|
||||
* Dev - Allow for cloning the WC_Cart object
|
||||
* Dev - Apply filters to registration-error-email-exists error.
|
||||
* Dev - Added `woocommerce_cross_sells_order` filter.
|
||||
* Dev - Add order-details `before` hooks to complement existing hooks.
|
||||
* Dev - Add order-details `before` hooks to complement existing hooks.
|
||||
* Dev - WC_CHUNK_SIZE constant for controlling readfile.
|
||||
* Dev - Add short circuit to customer bought product function.
|
||||
* Dev - Add short circuit to customer bought product function.
|
||||
* Dev - Added a `wc_caught_exception` method to aid with logging.
|
||||
* Dev - Added Data stores and CRUD for working with Webhooks.
|
||||
* Dev - Bumped minimum WP version requirement to 4.5 and removed legacy API files.
|
||||
|
@ -214,8 +224,11 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woocommerce/wo
|
|||
* Dev - Improved the `is_internal_meta_key` checks to consider getters and setters.
|
||||
* Dev - Cleaned up the Order Customer Details template.
|
||||
* Dev - JavaScript payment_method_selected events on checkout.
|
||||
* Dev - Add new `$order->get_edit_order_url()` method.
|
||||
* Dev - Pass through options to zoom, flexslider, and photoswipe.
|
||||
* Dev - Added actions before and after scheduled sales initiation and completion.
|
||||
* Localization - Add direction character to currency output.
|
||||
* Localization - States for Tanzania.
|
||||
* Localization - States for Tanzania and Moldova.
|
||||
|
||||
[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce/master/CHANGELOG.txt).
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
ID,Type,SKU,Name,Published,"Is featured?","Visibility in catalog","Short description",Description,"Date sale price starts","Date sale price ends","Tax status","Tax class","In stock?",Stock,"Backorders allowed?","Sold individually?","Weight (lbs)","Length (in)","Width (in)","Height (in)","Allow customer reviews?","Purchase note","Sale price","Regular price",Categories,Tags,"Shipping class",Images,"Download limit","Download expiry days",Parent,"Grouped products",Upsells,Cross-sells,"External URL","Button text",Position,"Attribute 1 name","Attribute 1 value(s)","Attribute 1 visible","Attribute 1 global","Attribute 2 name","Attribute 2 value(s)","Attribute 2 visible","Attribute 2 global","Meta: _wpcom_is_markdown","Download 1 name","Download 1 URL","Download 2 name","Download 2 URL"
|
||||
44,variable,woo-vneck-tee,"V-Neck T-Shirt",1,1,visible,"This is a variable product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,.5,24,1,2,1,,,,"Clothing > Tshirts",,,"https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vneck-tee-2.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vnech-tee-green-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vnech-tee-blue-1.jpg",,,,,,,,,0,Color,"Blue, Green, Red",1,1,Size,"Large, Medium, Small",1,1,1,,,,
|
||||
45,variable,woo-hoodie,Hoodie,1,0,visible,"This is a variable product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,1.5,10,8,3,1,,,,"Clothing > Hoodies",,,"https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-2.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-blue-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-green-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-logo-2.jpg",,,,,,,,,0,Color,"Blue, Green, Red",1,1,Logo,"Yes, No",1,0,1,,,,
|
||||
46,simple,woo-hoodie-with-logo,"Hoodie with Logo",1,0,visible,"This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,2,10,6,3,1,,,45,"Clothing > Hoodies",,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-logo-2.jpg,,,,,,,,,0,Color,Blue,1,1,,,,,1,,,,
|
||||
47,simple,woo-tshirt,T-Shirt,1,0,visible,"This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,.8,8,6,1,1,,,18,"Clothing > Tshirts",,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/tshirt-2.jpg,,,,,,,,,0,Color,Gray,1,1,,,,,1,,,,
|
||||
48,simple,woo-beanie,Beanie,1,0,visible,"This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,.2,4,5,.5,1,,18,20,"Clothing > Accessories",,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/beanie-2.jpg,,,,,,,,,0,Color,Red,1,1,,,,,1,,,,
|
||||
58,simple,woo-belt,Belt,1,0,visible,"This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,1.2,12,2,1.5,1,,55,65,"Clothing > Accessories",,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/belt-2.jpg,,,,,,,,,0,,,,,,,,,1,,,,
|
||||
60,simple,woo-cap,Cap,1,1,visible,"This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,0.6,8,6.5,4,1,,16,18,"Clothing > Accessories",,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/cap-2.jpg,,,,,,,,,0,Color,Yellow,1,1,,,,,1,,,,
|
||||
62,simple,woo-sunglasses,Sunglasses,1,1,visible,"This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,.2,4,1.4,1,1,,,90,"Clothing > Accessories",,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/sunglasses-2.jpg,,,,,,,,,0,,,,,,,,,1,,,,
|
||||
64,simple,woo-hoodie-with-pocket,"Hoodie with Pocket",1,1,hidden,"This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,3,10,8,2,1,,35,45,"Clothing > Hoodies",,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-pocket-2.jpg,,,,,,,,,0,Color,Gray,1,1,,,,,1,,,,
|
||||
66,simple,woo-hoodie-with-zipper,"Hoodie with Zipper",1,1,visible,"This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,2,8,6,2,1,,,45,"Clothing > Hoodies",,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-zipper-2.jpg,,,,,,,,,0,,,,,,,,,1,,,,
|
||||
68,simple,woo-long-sleeve-tee,"Long Sleeve Tee",1,0,visible,"This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,1,7,5,1,1,,,25,"Clothing > Tshirts",,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/long-sleeve-tee-2.jpg,,,,,,,,,0,Color,Green,1,1,,,,,1,,,,
|
||||
70,simple,woo-polo,Polo,1,0,visible,"This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,.8,6,5,1,1,,,20,"Clothing > Tshirts",,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/polo-2.jpg,,,,,,,,,0,Color,Blue,1,1,,,,,1,,,,
|
||||
73,"simple, downloadable, virtual",woo-album,Album,1,0,visible,"This is a simple, virtual product.","Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,1,,,15,Music,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/album-1.jpg,1,1,,,,,,,0,,,,,,,,,1,"Single 1",https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/single.jpg,"Single 2",https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/album.jpg
|
||||
75,"simple, downloadable, virtual",woo-single,Single,1,0,visible,"This is a simple, virtual product.","Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,1,,2,3,Music,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/single-1.jpg,1,1,,,,,,,0,,,,,,,,,1,Single,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/single.jpg,,
|
||||
76,variation,woo-vneck-tee-red,"V-Neck T-Shirt - Red",1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,0,,,20,,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vneck-tee-2.jpg,,,woo-vneck-tee,,,,,,0,Color,Red,,1,Size,,,1,,,,,
|
||||
77,variation,woo-vneck-tee-green,"V-Neck T-Shirt - Green",1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,0,,,20,,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vnech-tee-green-1.jpg,,,woo-vneck-tee,,,,,,0,Color,Green,,1,Size,,,1,,,,,
|
||||
78,variation,woo-vneck-tee-blue,"V-Neck T-Shirt - Blue",1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,0,,,15,,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vnech-tee-blue-1.jpg,,,woo-vneck-tee,,,,,,0,Color,Blue,,1,Size,,,1,,,,,
|
||||
79,variation,woo-hoodie-red,"Hoodie - Red, No",1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,0,,42,45,,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-2.jpg,,,woo-hoodie,,,,,,1,Color,Red,,1,Logo,No,,0,,,,,
|
||||
80,variation,woo-hoodie-green,"Hoodie - Green, No",1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,0,,,45,,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-green-1.jpg,,,woo-hoodie,,,,,,2,Color,Green,,1,Logo,No,,0,,,,,
|
||||
81,variation,woo-hoodie-blue,"Hoodie - Blue, No",1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,0,,,45,,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-blue-1.jpg,,,woo-hoodie,,,,,,3,Color,Blue,,1,Logo,No,,0,,,,,
|
||||
83,simple,Woo-tshirt-logo,"T-Shirt with Logo",1,0,visible,"This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,.5,10,12,.5,1,,,18,"Clothing > Tshirts",,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/t-shirt-with-logo-1.jpg,,,,,,,,,0,Color,Gray,1,1,,,,,1,,,,
|
||||
85,simple,Woo-beanie-logo,"Beanie with Logo",1,0,visible,"This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,.2,6,4,1,1,,18,20,"Clothing > Accessories",,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/beanie-with-logo-1.jpg,,,,,,,,,0,Color,Red,1,1,,,,,1,,,,
|
||||
87,grouped,logo-collection,"Logo Collection",1,0,visible,"This is a grouped product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,,,Clothing,,,"https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/logo-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/beanie-with-logo-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/t-shirt-with-logo-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-logo-2.jpg",,,,"woo-hoodie-with-logo, woo-tshirt, woo-beanie",,,,,0,,,,,,,,,1,,,,
|
||||
89,external,wp-pennant,"WordPress Pennant",1,0,visible,"This is an external product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,0,0,,,,,1,,,11.05,Decor,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/pennant-1.jpg,,,,,,,https://mercantile.wordpress.org/product/wordpress-pennant/,"Buy on the WordPress swag store!",0,,,,,,,,,1,,,,
|
||||
90,variation,woo-hoodie-blue-logo,"Hoodie - Blue, Yes",1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,0,0,,,,,0,,,45,,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-logo-2.jpg,,,woo-hoodie,,,,,,0,Color,Blue,,1,Logo,Yes,,0,,,,,
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,8 +10,7 @@
|
|||
* happen. When this occurs the version of the template file will be bumped and
|
||||
* the readme will list any important changes.
|
||||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @package WooCommerce/Templates/Auth
|
||||
* @version 3.3.0
|
||||
*/
|
||||
|
@ -24,11 +23,21 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
|
||||
<?php do_action( 'woocommerce_auth_page_header' ); ?>
|
||||
|
||||
<h1><?php printf( esc_html__( '%s would like to connect to your store' , 'woocommerce' ), esc_html( $app_name ) ); ?></h1>
|
||||
<h1>
|
||||
<?php
|
||||
/* translators: %s: app name */
|
||||
printf( esc_html__( '%s would like to connect to your store', 'woocommerce' ), esc_html( $app_name ) );
|
||||
?>
|
||||
</h1>
|
||||
|
||||
<?php wc_print_notices(); ?>
|
||||
|
||||
<p><?php printf( esc_html__( 'To connect to %1$s you need to be logged in. Log in to your store below, or <a href="%2$s">cancel and return to %1$s</a>', 'woocommerce' ), esc_html( wc_clean( $app_name ) ), esc_url( $return_url ) ); ?></p>
|
||||
<p>
|
||||
<?php
|
||||
/* translators: %1$s: app name, %2$s: URL */
|
||||
echo wp_kses_post( sprintf( __( 'To connect to %1$s you need to be logged in. Log in to your store below, or <a href="%2$s">cancel and return to %1$s</a>', 'woocommerce' ), esc_html( wc_clean( $app_name ) ), esc_url( $return_url ) ) );
|
||||
?>
|
||||
</p>
|
||||
|
||||
<form method="post" class="wc-auth-login">
|
||||
<p class="form-row form-row-wide">
|
||||
|
|
|
@ -44,11 +44,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<?php
|
||||
echo apply_filters( 'woocommerce_order_item_name', esc_html( $item->get_name() ), $item, false ); // @codingStandardsIgnoreLine
|
||||
|
||||
do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order );
|
||||
do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order, false );
|
||||
|
||||
wc_display_item_meta( $item );
|
||||
|
||||
do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order );
|
||||
do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order, false );
|
||||
?>
|
||||
</td>
|
||||
<td class="product-quantity"><?php echo apply_filters( 'woocommerce_order_item_quantity_html', ' <strong class="product-quantity">' . sprintf( '× %s', esc_html( $item->get_quantity() ) ) . '</strong>', $item ); ?></td><?php // @codingStandardsIgnoreLine ?>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
*/
|
||||
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
|
||||
|
||||
<p><?php printf( __( 'The order #%1$d from %2$s has been cancelled. The order was as follows:', 'woocommerce' ), $order->get_order_number(), $order->get_formatted_billing_full_name() ); ?></p>
|
||||
<p><?php printf( __( 'The order #%1$s from %2$s has been cancelled. The order was as follows:', 'woocommerce' ), $order->get_order_number(), $order->get_formatted_billing_full_name() ); ?></p>
|
||||
|
||||
<?php
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
*/
|
||||
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
|
||||
|
||||
<p><?php printf( __( 'Payment for order #%1$d from %2$s has failed. The order was as follows:', 'woocommerce' ), $order->get_order_number(), $order->get_formatted_billing_full_name() ); ?></p>
|
||||
<p><?php printf( __( 'Payment for order #%1$s from %2$s has failed. The order was as follows:', 'woocommerce' ), $order->get_order_number(), $order->get_formatted_billing_full_name() ); ?></p>
|
||||
|
||||
<?php
|
||||
|
||||
|
|
|
@ -10,10 +10,9 @@
|
|||
* happen. When this occurs the version of the template file will be bumped and
|
||||
* the readme will list any important changes.
|
||||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates/Emails
|
||||
* @version 3.2.0
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @package WooCommerce/Templates/Emails
|
||||
* @version 3.3.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
@ -24,48 +23,64 @@ $text_align = is_rtl() ? 'right' : 'left';
|
|||
|
||||
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email ); ?>
|
||||
|
||||
<?php if ( ! $sent_to_admin ) : ?>
|
||||
<h2><?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?> (<?php printf( '<time datetime="%s">%s</time>', $order->get_date_created()->format( 'c' ), wc_format_datetime( $order->get_date_created() ) ); ?>)</h2>
|
||||
<?php else : ?>
|
||||
<h2><a class="link" href="<?php echo esc_url( admin_url( 'post.php?post=' . $order->get_id() . '&action=edit' ) ); ?>"><?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?></a> (<?php printf( '<time datetime="%s">%s</time>', $order->get_date_created()->format( 'c' ), wc_format_datetime( $order->get_date_created() ) ); ?>)</h2>
|
||||
<?php endif; ?>
|
||||
<h2>
|
||||
<?php
|
||||
if ( $sent_to_admin ) {
|
||||
$before = '<a class="link" href="' . esc_url( $order->get_edit_order_url() ) . '">';
|
||||
$after = '</a>';
|
||||
} else {
|
||||
$before = '';
|
||||
$after = '';
|
||||
}
|
||||
/* translators: %s: Order ID. */
|
||||
echo wp_kses_post( $before . sprintf( __( 'Order #%s', 'woocommerce' ) . $after . ' (<time datetime="%s">%s</time>)', $order->get_order_number(), $order->get_date_created()->format( 'c' ), wc_format_datetime( $order->get_date_created() ) ) );
|
||||
?>
|
||||
</h2>
|
||||
|
||||
<div style="margin-bottom: 40px;">
|
||||
<table class="td" cellspacing="0" cellpadding="6" style="width: 100%; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;" border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="td" scope="col" style="text-align:<?php echo $text_align; ?>;"><?php _e( 'Product', 'woocommerce' ); ?></th>
|
||||
<th class="td" scope="col" style="text-align:<?php echo $text_align; ?>;"><?php _e( 'Quantity', 'woocommerce' ); ?></th>
|
||||
<th class="td" scope="col" style="text-align:<?php echo $text_align; ?>;"><?php _e( 'Price', 'woocommerce' ); ?></th>
|
||||
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
|
||||
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></th>
|
||||
<th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Price', 'woocommerce' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php echo wc_get_email_order_items( $order, array(
|
||||
<?php
|
||||
echo wc_get_email_order_items( $order, array( // WPCS: XSS ok.
|
||||
'show_sku' => $sent_to_admin,
|
||||
'show_image' => false,
|
||||
'image_size' => array( 32, 32 ),
|
||||
'plain_text' => $plain_text,
|
||||
'sent_to_admin' => $sent_to_admin,
|
||||
) ); ?>
|
||||
) );
|
||||
?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<?php
|
||||
if ( $totals = $order->get_order_item_totals() ) {
|
||||
$i = 0;
|
||||
foreach ( $totals as $total ) {
|
||||
$i++;
|
||||
?><tr>
|
||||
<th class="td" scope="row" colspan="2" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo $total['label']; ?></th>
|
||||
<td class="td" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo $total['value']; ?></td>
|
||||
</tr><?php
|
||||
}
|
||||
}
|
||||
if ( $order->get_customer_note() ) {
|
||||
?><tr>
|
||||
<th class="td" scope="row" colspan="2" style="text-align:<?php echo $text_align; ?>;"><?php _e( 'Note:', 'woocommerce' ); ?></th>
|
||||
<td class="td" style="text-align:<?php echo $text_align; ?>;"><?php echo wptexturize( $order->get_customer_note() ); ?></td>
|
||||
</tr><?php
|
||||
$totals = $order->get_order_item_totals();
|
||||
|
||||
if ( $totals ) {
|
||||
$i = 0;
|
||||
foreach ( $totals as $total ) {
|
||||
$i++;
|
||||
?>
|
||||
<tr>
|
||||
<th class="td" scope="row" colspan="2" style="text-align:<?php echo esc_attr( $text_align ); ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo wp_kses_post( $total['label'] ); ?></th>
|
||||
<td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo wp_kses_post( $total['value'] ); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
if ( $order->get_customer_note() ) {
|
||||
?>
|
||||
<tr>
|
||||
<th class="td" scope="row" colspan="2" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Note:', 'woocommerce' ); ?></th>
|
||||
<td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php echo wp_kses_post( wptexturize( $order->get_customer_note() ) ); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
|
|
@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
|
||||
echo "= " . $email_heading . " =\n\n";
|
||||
|
||||
echo sprintf( __( 'The order #%1$d from %2$s has been cancelled. The order was as follows:', 'woocommerce' ), $order->get_id(), $order->get_formatted_billing_full_name() ) . "\n\n";
|
||||
echo sprintf( __( 'The order #%1$s from %2$s has been cancelled. The order was as follows:', 'woocommerce' ), $order->get_order_number(), $order->get_formatted_billing_full_name() ) . "\n\n";
|
||||
|
||||
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
|
||||
echo "= " . $email_heading . " =\n\n";
|
||||
|
||||
echo sprintf( __( 'Payment for order #%1$d from %2$s has failed. The order was as follows:', 'woocommerce' ), $order->get_id(), $order->get_formatted_billing_full_name() ) . "\n\n";
|
||||
echo sprintf( __( 'Payment for order #%1$s from %2$s has failed. The order was as follows:', 'woocommerce' ), $order->get_order_number(), $order->get_formatted_billing_full_name() ) . "\n\n";
|
||||
|
||||
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
|
||||
|
||||
|
|
|
@ -10,10 +10,9 @@
|
|||
* happen. When this occurs the version of the template file will be bumped and
|
||||
* the readme will list any important changes.
|
||||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates/Emails
|
||||
* @version 3.2.0
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @package WooCommerce/Templates/Emails
|
||||
* @version 3.3.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
@ -22,9 +21,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
|
||||
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email );
|
||||
|
||||
echo strtoupper( sprintf( __( 'Order number: %s', 'woocommerce' ), $order->get_order_number() ) ) . "\n";
|
||||
echo wc_format_datetime( $order->get_date_created() ) . "\n";
|
||||
echo "\n" . wc_get_email_order_items( $order, array(
|
||||
/* translators: %s: Order ID. */
|
||||
echo wp_kses_post( strtoupper( sprintf( __( 'Order number: %s', 'woocommerce' ), $order->get_order_number() ) ) ) . "\n";
|
||||
echo wc_format_datetime( $order->get_date_created() ) . "\n"; // WPCS: XSS ok.
|
||||
echo "\n" . wc_get_email_order_items( $order, array( // WPCS: XSS ok.
|
||||
'show_sku' => $sent_to_admin,
|
||||
'show_image' => false,
|
||||
'image_size' => array( 32, 32 ),
|
||||
|
@ -34,18 +34,21 @@ echo "\n" . wc_get_email_order_items( $order, array(
|
|||
|
||||
echo "==========\n\n";
|
||||
|
||||
if ( $totals = $order->get_order_item_totals() ) {
|
||||
$totals = $order->get_order_item_totals();
|
||||
|
||||
if ( $totals ) {
|
||||
foreach ( $totals as $total ) {
|
||||
echo $total['label'] . "\t " . $total['value'] . "\n";
|
||||
echo wp_kses_post( $total['label'] . "\t " . $total['value'] ) . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ( $order->get_customer_note() ) {
|
||||
echo __( 'Note:', 'woocommerce' ) . "\t " . wptexturize( $order->get_customer_note() ) . "\n";
|
||||
echo esc_html__( 'Note:', 'woocommerce' ) . "\t " . wp_kses_post( wptexturize( $order->get_customer_note() ) ) . "\n";
|
||||
}
|
||||
|
||||
if ( $sent_to_admin ) {
|
||||
echo "\n" . sprintf( __( 'View order: %s', 'woocommerce' ), admin_url( 'post.php?post=' . $order->get_id() . '&action=edit' ) ) . "\n";
|
||||
/* translators: %s: Order link. */
|
||||
echo "\n" . sprintf( esc_html__( 'View order: %s', 'woocommerce' ), esc_url( $order->get_edit_order_url() ) ) . "\n";
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text, $email );
|
||||
|
|
|
@ -34,11 +34,11 @@ if ( ! apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
|
|||
echo apply_filters( 'woocommerce_order_item_name', $product_permalink ? sprintf( '<a href="%s">%s</a>', $product_permalink, $item->get_name() ) : $item->get_name(), $item, $is_visible );
|
||||
echo apply_filters( 'woocommerce_order_item_quantity_html', ' <strong class="product-quantity">' . sprintf( '× %s', $item->get_quantity() ) . '</strong>', $item );
|
||||
|
||||
do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order );
|
||||
do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order, false );
|
||||
|
||||
wc_display_item_meta( $item );
|
||||
|
||||
do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order );
|
||||
do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order, false );
|
||||
?>
|
||||
</td>
|
||||
|
||||
|
|
|
@ -11,14 +11,11 @@
|
|||
* the readme will list any important changes.
|
||||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 3.3.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
global $product, $post;
|
||||
|
||||
|
@ -39,8 +36,8 @@ do_action( 'woocommerce_before_add_to_cart_form' ); ?>
|
|||
foreach ( $grouped_products as $grouped_product ) {
|
||||
$post_object = get_post( $grouped_product->get_id() );
|
||||
$quantites_required = $quantites_required || ( $grouped_product->is_purchasable() && ! $grouped_product->has_options() );
|
||||
|
||||
setup_postdata( $post = $post_object ); // WPCS: override ok.
|
||||
$post = $post_object; // WPCS: override ok.
|
||||
setup_postdata( $post );
|
||||
|
||||
echo '<tr id="product-' . esc_attr( get_the_ID() ) . '" class="woocommerce-grouped-product-list-item ' . esc_attr( implode( ' ', get_post_class() ) ) . '">';
|
||||
|
||||
|
@ -49,7 +46,7 @@ do_action( 'woocommerce_before_add_to_cart_form' ); ?>
|
|||
do_action( 'woocommerce_grouped_product_list_before_' . $column_id, $grouped_product );
|
||||
|
||||
switch ( $column_id ) {
|
||||
case 'quantity' :
|
||||
case 'quantity':
|
||||
ob_start();
|
||||
|
||||
if ( ! $grouped_product->is_purchasable() || $grouped_product->has_options() || ! $grouped_product->is_in_stock() ) {
|
||||
|
@ -71,27 +68,28 @@ do_action( 'woocommerce_before_add_to_cart_form' ); ?>
|
|||
|
||||
$value = ob_get_clean();
|
||||
break;
|
||||
case 'label' :
|
||||
case 'label':
|
||||
$value = '<label for="product-' . esc_attr( $grouped_product->get_id() ) . '">';
|
||||
$value .= $grouped_product->is_visible() ? '<a href="' . esc_url( apply_filters( 'woocommerce_grouped_product_list_link', get_permalink( $grouped_product->get_id() ), $grouped_product->get_id() ) ) . '">' . $grouped_product->get_name() . '</a>' : $grouped_product->get_name();
|
||||
$value .= '</label>';
|
||||
break;
|
||||
case 'price' :
|
||||
case 'price':
|
||||
$value = $grouped_product->get_price_html() . wc_get_stock_html( $grouped_product );
|
||||
break;
|
||||
default :
|
||||
default:
|
||||
$value = '';
|
||||
break;
|
||||
}
|
||||
|
||||
echo '<td class="woocommerce-grouped-product-list-item__' . esc_attr( $column_id ) . ' ' . esc_attr( $column_id ) . '">' . apply_filters( 'woocommerce_grouped_product_list_column_' . $column_id, $value, $grouped_product ) . '</td>'; // WPCS: XSS ok.
|
||||
echo '<td class="woocommerce-grouped-product-list-item__' . esc_attr( $column_id ) . '">' . apply_filters( 'woocommerce_grouped_product_list_column_' . $column_id, $value, $grouped_product ) . '</td>'; // WPCS: XSS ok.
|
||||
|
||||
do_action( 'woocommerce_grouped_product_list_after_' . $column_id, $grouped_product );
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
}
|
||||
setup_postdata( $post = $previous_post ); // WPCS: override ok.
|
||||
$post = $previous_post; // WPCS: override ok.
|
||||
setup_postdata( $post );
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -123,6 +123,71 @@ install_db() {
|
|||
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
|
||||
}
|
||||
|
||||
install_e2e_site() {
|
||||
|
||||
if [[ ${RUN_E2E} == 1 ]]; then
|
||||
|
||||
# Script Variables
|
||||
CONFIG_DIR="./tests/e2e-tests/config/travis"
|
||||
WP_CORE_DIR="$HOME/wordpress"
|
||||
NGINX_DIR="$HOME/nginx"
|
||||
PHP_FPM_BIN="$HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/sbin/php-fpm"
|
||||
PHP_FPM_CONF="$NGINX_DIR/php-fpm.conf"
|
||||
WP_SITE_URL="http://localhost:8080"
|
||||
BRANCH=$TRAVIS_BRANCH
|
||||
REPO=$TRAVIS_REPO_SLUG
|
||||
WP_DB_DATA="$HOME/build/$REPO/tests/e2e-tests/data/e2e-db.sql"
|
||||
WORKING_DIR="$PWD"
|
||||
|
||||
if [ "$TRAVIS_PULL_REQUEST_BRANCH" != "" ]; then
|
||||
BRANCH=$TRAVIS_PULL_REQUEST_BRANCH
|
||||
REPO=$TRAVIS_PULL_REQUEST_SLUG
|
||||
fi
|
||||
|
||||
set -ev
|
||||
npm install
|
||||
export NODE_CONFIG_DIR="./tests/e2e-tests/config"
|
||||
|
||||
# Set up nginx to run the server
|
||||
mkdir -p "$WP_CORE_DIR"
|
||||
mkdir -p "$NGINX_DIR"
|
||||
mkdir -p "$NGINX_DIR/sites-enabled"
|
||||
mkdir -p "$NGINX_DIR/var"
|
||||
|
||||
cp "$CONFIG_DIR/travis_php-fpm.conf" "$PHP_FPM_CONF"
|
||||
|
||||
# Start php-fpm
|
||||
"$PHP_FPM_BIN" --fpm-config "$PHP_FPM_CONF"
|
||||
|
||||
# Copy the default nginx config files.
|
||||
cp "$CONFIG_DIR/travis_nginx.conf" "$NGINX_DIR/nginx.conf"
|
||||
cp "$CONFIG_DIR/travis_fastcgi.conf" "$NGINX_DIR/fastcgi.conf"
|
||||
cp "$CONFIG_DIR/travis_default-site.conf" "$NGINX_DIR/sites-enabled/default-site.conf"
|
||||
|
||||
# Start nginx.
|
||||
nginx -c "$NGINX_DIR/nginx.conf"
|
||||
|
||||
# Set up WordPress using wp-cli
|
||||
cd "$WP_CORE_DIR"
|
||||
|
||||
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||
php wp-cli.phar core download --version=$WP_VERSION
|
||||
php wp-cli.phar core config --dbname=$DB_NAME --dbuser=$DB_USER --dbpass=$DB_PASS --dbhost=$DB_HOST --dbprefix=wp_ --extra-php <<PHP
|
||||
/* Change WP_MEMORY_LIMIT to increase the memory limit for public pages. */
|
||||
define('WP_MEMORY_LIMIT', '256M');
|
||||
PHP
|
||||
php wp-cli.phar core install --url="$WP_SITE_URL" --title="Example" --admin_user=admin --admin_password=password --admin_email=info@example.com --path=$WP_CORE_DIR --skip-email
|
||||
php wp-cli.phar db import $WP_DB_DATA
|
||||
php wp-cli.phar search-replace "http://local.wordpress.test" "$WP_SITE_URL"
|
||||
php wp-cli.phar theme install twentytwelve --activate
|
||||
php wp-cli.phar plugin install https://github.com/$REPO/archive/$BRANCH.zip --activate
|
||||
|
||||
cd "$WORKING_DIR"
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
install_wp
|
||||
install_test_suite
|
||||
install_db
|
||||
install_e2e_site
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
if [[ ${RUN_E2E} == 1 ]]; then
|
||||
|
||||
WP_SITE_URL="http://localhost:8080"
|
||||
|
||||
# Start xvfb to run the tests
|
||||
export BASE_URL="$WP_SITE_URL"
|
||||
export DISPLAY=:99.0
|
||||
sh -e /etc/init.d/xvfb start
|
||||
sleep 3
|
||||
|
||||
# Run the tests
|
||||
npm test
|
||||
fi
|
|
@ -25,20 +25,24 @@ class WC_Unit_Tests_Bootstrap {
|
|||
*/
|
||||
public function __construct() {
|
||||
|
||||
ini_set( 'display_errors','on' );
|
||||
// phpcs:disable WordPress.PHP.DiscouragedPHPFunctions, WordPress.PHP.DevelopmentFunctions
|
||||
ini_set( 'display_errors', 'on' );
|
||||
error_reporting( E_ALL );
|
||||
// phpcs:enable WordPress.PHP.DiscouragedPHPFunctions, WordPress.PHP.DevelopmentFunctions
|
||||
|
||||
// Ensure server variable is set for WP email functions.
|
||||
// phpcs:disable WordPress.VIP.SuperGlobalInputUsage.AccessDetected
|
||||
if ( ! isset( $_SERVER['SERVER_NAME'] ) ) {
|
||||
$_SERVER['SERVER_NAME'] = 'localhost';
|
||||
}
|
||||
// phpcs:enable WordPress.VIP.SuperGlobalInputUsage.AccessDetected
|
||||
|
||||
$this->tests_dir = dirname( __FILE__ );
|
||||
$this->plugin_dir = dirname( $this->tests_dir );
|
||||
$this->wp_tests_dir = getenv( 'WP_TESTS_DIR' ) ? getenv( 'WP_TESTS_DIR' ) : '/tmp/wordpress-tests-lib';
|
||||
|
||||
// load test function so tests_add_filter() is available
|
||||
require_once( $this->wp_tests_dir . '/includes/functions.php' );
|
||||
require_once $this->wp_tests_dir . '/includes/functions.php';
|
||||
|
||||
// load WC
|
||||
tests_add_filter( 'muplugins_loaded', array( $this, 'load_wc' ) );
|
||||
|
@ -47,7 +51,7 @@ class WC_Unit_Tests_Bootstrap {
|
|||
tests_add_filter( 'setup_theme', array( $this, 'install_wc' ) );
|
||||
|
||||
// load the WP testing environment
|
||||
require_once( $this->wp_tests_dir . '/includes/bootstrap.php' );
|
||||
require_once $this->wp_tests_dir . '/includes/bootstrap.php';
|
||||
|
||||
// load WC testing framework
|
||||
$this->includes();
|
||||
|
@ -60,7 +64,7 @@ class WC_Unit_Tests_Bootstrap {
|
|||
*/
|
||||
public function load_wc() {
|
||||
define( 'WC_TAX_ROUNDING_MODE', 'auto' );
|
||||
require_once( $this->plugin_dir . '/woocommerce.php' );
|
||||
require_once $this->plugin_dir . '/woocommerce.php';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,7 +77,7 @@ class WC_Unit_Tests_Bootstrap {
|
|||
// Clean existing install first.
|
||||
define( 'WP_UNINSTALL_PLUGIN', true );
|
||||
define( 'WC_REMOVE_ALL_DATA', true );
|
||||
include( $this->plugin_dir . '/uninstall.php' );
|
||||
include $this->plugin_dir . '/uninstall.php';
|
||||
|
||||
WC_Install::install();
|
||||
|
||||
|
@ -81,11 +85,11 @@ class WC_Unit_Tests_Bootstrap {
|
|||
if ( version_compare( $GLOBALS['wp_version'], '4.7', '<' ) ) {
|
||||
$GLOBALS['wp_roles']->reinit();
|
||||
} else {
|
||||
$GLOBALS['wp_roles'] = null;
|
||||
$GLOBALS['wp_roles'] = null; // WPCS: override ok.
|
||||
wp_roles();
|
||||
}
|
||||
|
||||
echo 'Installing WooCommerce...' . PHP_EOL;
|
||||
echo esc_html( 'Installing WooCommerce...' . PHP_EOL );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,28 +100,28 @@ class WC_Unit_Tests_Bootstrap {
|
|||
public function includes() {
|
||||
|
||||
// framework
|
||||
require_once( $this->tests_dir . '/framework/class-wc-unit-test-factory.php' );
|
||||
require_once( $this->tests_dir . '/framework/class-wc-mock-session-handler.php' );
|
||||
require_once( $this->tests_dir . '/framework/class-wc-mock-wc-data.php' );
|
||||
require_once( $this->tests_dir . '/framework/class-wc-mock-wc-object-query.php' );
|
||||
require_once( $this->tests_dir . '/framework/class-wc-payment-token-stub.php' );
|
||||
require_once( $this->tests_dir . '/framework/vendor/class-wp-test-spy-rest-server.php' );
|
||||
require_once $this->tests_dir . '/framework/class-wc-unit-test-factory.php';
|
||||
require_once $this->tests_dir . '/framework/class-wc-mock-session-handler.php';
|
||||
require_once $this->tests_dir . '/framework/class-wc-mock-wc-data.php';
|
||||
require_once $this->tests_dir . '/framework/class-wc-mock-wc-object-query.php';
|
||||
require_once $this->tests_dir . '/framework/class-wc-payment-token-stub.php';
|
||||
require_once $this->tests_dir . '/framework/vendor/class-wp-test-spy-rest-server.php';
|
||||
|
||||
// test cases
|
||||
require_once( $this->tests_dir . '/framework/class-wc-unit-test-case.php' );
|
||||
require_once( $this->tests_dir . '/framework/class-wc-api-unit-test-case.php' );
|
||||
require_once( $this->tests_dir . '/framework/class-wc-rest-unit-test-case.php' );
|
||||
require_once $this->tests_dir . '/framework/class-wc-unit-test-case.php';
|
||||
require_once $this->tests_dir . '/framework/class-wc-api-unit-test-case.php';
|
||||
require_once $this->tests_dir . '/framework/class-wc-rest-unit-test-case.php';
|
||||
|
||||
// Helpers
|
||||
require_once( $this->tests_dir . '/framework/helpers/class-wc-helper-product.php' );
|
||||
require_once( $this->tests_dir . '/framework/helpers/class-wc-helper-coupon.php' );
|
||||
require_once( $this->tests_dir . '/framework/helpers/class-wc-helper-fee.php' );
|
||||
require_once( $this->tests_dir . '/framework/helpers/class-wc-helper-shipping.php' );
|
||||
require_once( $this->tests_dir . '/framework/helpers/class-wc-helper-customer.php' );
|
||||
require_once( $this->tests_dir . '/framework/helpers/class-wc-helper-order.php' );
|
||||
require_once( $this->tests_dir . '/framework/helpers/class-wc-helper-shipping-zones.php' );
|
||||
require_once( $this->tests_dir . '/framework/helpers/class-wc-helper-payment-token.php' );
|
||||
require_once( $this->tests_dir . '/framework/helpers/class-wc-helper-settings.php' );
|
||||
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-product.php';
|
||||
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-coupon.php';
|
||||
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-fee.php';
|
||||
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-shipping.php';
|
||||
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-customer.php';
|
||||
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-order.php';
|
||||
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-shipping-zones.php';
|
||||
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-payment-token.php';
|
||||
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-settings.php';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"url": "BASE_URL"
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
server {
|
||||
listen 8080 default_server;
|
||||
listen [::]:8080 default_server ipv6only=on;
|
||||
|
||||
root /home/travis/wordpress;
|
||||
|
||||
access_log /tmp/access.log;
|
||||
error_log /tmp/error.log;
|
||||
|
||||
## This should be in your http block and if it is, it's not needed here.
|
||||
index index.php;
|
||||
|
||||
location ~* "\.php(/|$)" {
|
||||
include fastcgi.conf;
|
||||
fastcgi_pass php;
|
||||
}
|
||||
|
||||
location / {
|
||||
# This is cool because no php is touched for static content.
|
||||
# include the "?$args" part so non-default permalinks doesn't break when using query string
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
fastcgi_param QUERY_STRING $query_string;
|
||||
fastcgi_param REQUEST_METHOD $request_method;
|
||||
fastcgi_param CONTENT_TYPE $content_type;
|
||||
fastcgi_param CONTENT_LENGTH $content_length;
|
||||
|
||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
fastcgi_param DOCUMENT_URI $document_uri;
|
||||
fastcgi_param DOCUMENT_ROOT $document_root;
|
||||
fastcgi_param SERVER_PROTOCOL $server_protocol;
|
||||
fastcgi_param HTTPS $https if_not_empty;
|
||||
|
||||
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
|
||||
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
|
||||
|
||||
fastcgi_param REMOTE_ADDR $remote_addr;
|
||||
fastcgi_param REMOTE_PORT $remote_port;
|
||||
fastcgi_param SERVER_ADDR $server_addr;
|
||||
fastcgi_param SERVER_PORT $server_port;
|
||||
fastcgi_param SERVER_NAME $server_name;
|
||||
|
||||
# PHP only, required if PHP was built with --enable-force-cgi-redirect
|
||||
fastcgi_param REDIRECT_STATUS 200;
|
||||
|
||||
fastcgi_split_path_info ^(.+\.php)(.*)$;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
#fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
|
||||
# fastcgi_intercept_errors on;
|
||||
fastcgi_ignore_client_abort off;
|
||||
fastcgi_connect_timeout 60;
|
||||
fastcgi_send_timeout 1800;
|
||||
fastcgi_read_timeout 1800;
|
||||
fastcgi_buffer_size 128k;
|
||||
fastcgi_buffers 4 256k;
|
||||
fastcgi_busy_buffers_size 256k;
|
||||
fastcgi_temp_file_write_size 256k;
|
||||
fastcgi_keep_conn on;
|
|
@ -0,0 +1,52 @@
|
|||
error_log /tmp/error.log;
|
||||
pid /tmp/nginx.pid;
|
||||
worker_processes 1;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
# Set an array of temp and cache file options that will otherwise default to restricted locations accessible only to root.
|
||||
client_body_temp_path /tmp/client_body;
|
||||
fastcgi_temp_path /tmp/fastcgi_temp;
|
||||
proxy_temp_path /tmp/proxy_temp;
|
||||
scgi_temp_path /tmp/scgi_temp;
|
||||
uwsgi_temp_path /tmp/uwsgi_temp;
|
||||
|
||||
##
|
||||
# Basic Settings
|
||||
##
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
# server_tokens off;
|
||||
# server_names_hash_bucket_size 64;
|
||||
# server_name_in_redirect off;
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
##
|
||||
# Logging Settings
|
||||
##
|
||||
access_log /tmp/access.log;
|
||||
error_log /tmp/error.log;
|
||||
|
||||
##
|
||||
# Gzip Settings
|
||||
##
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
|
||||
##
|
||||
# Virtual Host Configs
|
||||
##
|
||||
# include /tmp/nginx/conf.d/*.conf;
|
||||
include /home/travis/nginx/sites-enabled/*;
|
||||
|
||||
upstream php {
|
||||
server 127.0.0.1:9000;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
[global]
|
||||
|
||||
[travis]
|
||||
user = $USER
|
||||
listen = 9000
|
||||
listen.mode = 0666
|
||||
pm = static
|
||||
pm.max_children = 5
|
||||
php_admin_value[memory_limit] = 32M
|
|
@ -47,7 +47,7 @@ class Payment_Gateways extends WC_REST_Unit_Test_Case {
|
|||
'title' => 'Check payments',
|
||||
'description' => 'Please send a check to Store Name, Store Street, Store Town, Store State / County, Store Postcode.',
|
||||
'order' => '',
|
||||
'enabled' => true,
|
||||
'enabled' => false,
|
||||
'method_title' => 'Check payments',
|
||||
'method_description' => 'Allows check payments. Why would you take checks in this day and age? Well you probably would not, but it does allow you to make test purchases for testing order emails and the success pages.',
|
||||
'settings' => array_diff_key( $this->get_settings( 'WC_Gateway_Cheque' ), array( 'enabled' => false, 'description' => false ) ),
|
||||
|
@ -94,7 +94,7 @@ class Payment_Gateways extends WC_REST_Unit_Test_Case {
|
|||
'title' => 'PayPal',
|
||||
'description' => "Pay via PayPal; you can pay with your credit card if you don't have a PayPal account.",
|
||||
'order' => '',
|
||||
'enabled' => true,
|
||||
'enabled' => false,
|
||||
'method_title' => 'PayPal',
|
||||
'method_description' => 'PayPal Standard sends customers to PayPal to enter their payment information. PayPal IPN requires fsockopen/cURL support to update order statuses after payment. Check the <a href="http://example.org/wp-admin/admin.php?page=wc-status">system status</a> page for more details.',
|
||||
'settings' => array_diff_key( $this->get_settings( 'WC_Gateway_Paypal' ), array( 'enabled' => false, 'description' => false ) ),
|
||||
|
|
|
@ -15,17 +15,17 @@ class WC_Tests_Coupon extends WC_Unit_Test_Case {
|
|||
$string_code_1 = 'test';
|
||||
|
||||
// Coupon with a standard string code.
|
||||
$coupon_1 = new WC_Coupon;
|
||||
$coupon_1 = new WC_Coupon();
|
||||
$coupon_1->set_code( $string_code_1 );
|
||||
$coupon_1->save();
|
||||
|
||||
// Coupon with a string code that is the same as coupon 1's ID.
|
||||
$coupon_2 = new WC_Coupon;
|
||||
$coupon_2 = new WC_Coupon();
|
||||
$coupon_2->set_code( (string) $coupon_1->get_id() );
|
||||
$coupon_2->save();
|
||||
|
||||
$int_id_1 = $coupon_1->get_id();
|
||||
$int_id_2 = $coupon_2->get_id();
|
||||
$int_id_1 = $coupon_1->get_id();
|
||||
$int_id_2 = $coupon_2->get_id();
|
||||
$string_code_2 = $coupon_2->get_code();
|
||||
|
||||
// Test getting a coupon by integer ID.
|
||||
|
|
|
@ -10,7 +10,7 @@ class WC_Tests_Coupon_Data_Store extends WC_Unit_Test_Case {
|
|||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function test_coupon_store_loads() {
|
||||
public function test_coupon_store_loads() {
|
||||
$store = new WC_Data_Store( 'coupon' );
|
||||
$this->assertTrue( is_callable( array( $store, 'read' ) ) );
|
||||
$this->assertEquals( 'WC_Coupon_Data_Store_CPT', $store->get_current_class_name() );
|
||||
|
@ -20,9 +20,9 @@ class WC_Tests_Coupon_Data_Store extends WC_Unit_Test_Case {
|
|||
* Test coupon create.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function test_coupon_create() {
|
||||
$code = 'coupon-' . time();
|
||||
$coupon = new WC_Coupon;
|
||||
public function test_coupon_create() {
|
||||
$code = 'coupon-' . time();
|
||||
$coupon = new WC_Coupon();
|
||||
$coupon->set_code( $code );
|
||||
$coupon->set_description( 'This is a test comment.' );
|
||||
$coupon->save();
|
||||
|
@ -35,8 +35,8 @@ class WC_Tests_Coupon_Data_Store extends WC_Unit_Test_Case {
|
|||
* Test coupon deletion.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function test_coupon_delete() {
|
||||
$coupon = WC_Helper_Coupon::create_coupon();
|
||||
public function test_coupon_delete() {
|
||||
$coupon = WC_Helper_Coupon::create_coupon();
|
||||
$coupon_id = $coupon->get_id();
|
||||
$this->assertNotEquals( 0, $coupon_id );
|
||||
$coupon->delete( true );
|
||||
|
@ -52,7 +52,7 @@ class WC_Tests_Coupon_Data_Store extends WC_Unit_Test_Case {
|
|||
$coupon->delete( true );
|
||||
|
||||
$cache_name = WC_Cache_Helper::get_cache_prefix( 'coupons' ) . 'coupon_id_from_code_' . $coupon->get_code();
|
||||
$ids = wp_cache_get( $cache_name, 'coupons' );
|
||||
$ids = wp_cache_get( $cache_name, 'coupons' );
|
||||
|
||||
$this->assertEquals( false, $ids, sprintf( 'Object cache for %s was not removed upon deletion of coupon.', $cache_name ) );
|
||||
}
|
||||
|
@ -61,8 +61,8 @@ class WC_Tests_Coupon_Data_Store extends WC_Unit_Test_Case {
|
|||
* Test coupon update.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function test_coupon_update() {
|
||||
$coupon = WC_Helper_Coupon::create_coupon();
|
||||
public function test_coupon_update() {
|
||||
$coupon = WC_Helper_Coupon::create_coupon();
|
||||
$coupon_id = $coupon->get_id();
|
||||
$this->assertEquals( 'dummycoupon', $coupon->get_code() );
|
||||
$coupon->set_code( 'dummycoupon2' );
|
||||
|
@ -75,9 +75,9 @@ class WC_Tests_Coupon_Data_Store extends WC_Unit_Test_Case {
|
|||
* Test coupon reading from the DB.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function test_coupon_read() {
|
||||
$code = 'coupon-' . time();
|
||||
$coupon = new WC_Coupon;
|
||||
public function test_coupon_read() {
|
||||
$code = 'coupon-' . time();
|
||||
$coupon = new WC_Coupon();
|
||||
$coupon->set_code( $code );
|
||||
$coupon->set_description( 'This is a test coupon.' );
|
||||
$coupon->set_usage_count( 5 );
|
||||
|
@ -95,8 +95,8 @@ class WC_Tests_Coupon_Data_Store extends WC_Unit_Test_Case {
|
|||
* Test coupon saving.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function test_coupon_save() {
|
||||
$coupon = WC_Helper_Coupon::create_coupon();
|
||||
public function test_coupon_save() {
|
||||
$coupon = WC_Helper_Coupon::create_coupon();
|
||||
$coupon_id = $coupon->get_id();
|
||||
$coupon->set_code( 'dummycoupon2' );
|
||||
$coupon->save();
|
||||
|
@ -104,7 +104,7 @@ class WC_Tests_Coupon_Data_Store extends WC_Unit_Test_Case {
|
|||
$this->assertEquals( 'dummycoupon2', $coupon->get_code() );
|
||||
$this->assertEquals( $coupon_id, $coupon->get_id() );
|
||||
|
||||
$new_coupon = new WC_Coupon;
|
||||
$new_coupon = new WC_Coupon();
|
||||
$new_coupon->set_code( 'dummycoupon3' );
|
||||
$new_coupon->save();
|
||||
$new_coupon_id = $new_coupon->get_id();
|
||||
|
@ -116,7 +116,7 @@ class WC_Tests_Coupon_Data_Store extends WC_Unit_Test_Case {
|
|||
* Test coupon date saving/loading.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function test_coupon_date_saving() {
|
||||
public function test_coupon_date_saving() {
|
||||
$expiry_date = time() - 10;
|
||||
|
||||
$coupon = WC_Helper_Coupon::create_coupon( 'coupon-' . time() );
|
||||
|
@ -132,7 +132,7 @@ class WC_Tests_Coupon_Data_Store extends WC_Unit_Test_Case {
|
|||
* Test coupon increase, decrease, user usage count methods.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function test_coupon_usage_magic_methods() {
|
||||
public function test_coupon_usage_magic_methods() {
|
||||
$coupon = WC_Helper_Coupon::create_coupon();
|
||||
$user_id = 1;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class WC_Tests_Coupon_Data extends WC_Unit_Test_Case {
|
|||
* @return string
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function get_function_name( $function ) {
|
||||
public function get_function_name( $function ) {
|
||||
if ( 'exclude_product_ids' === $function ) {
|
||||
$function = 'excluded_product_ids';
|
||||
} elseif ( 'exclude_product_categories' === $function ) {
|
||||
|
@ -32,7 +32,7 @@ class WC_Tests_Coupon_Data extends WC_Unit_Test_Case {
|
|||
public function test_coupon_backwards_compat_props_use_correct_getters() {
|
||||
// Accessing properties directly will throw some wanted deprected notices
|
||||
// So we need to let PHPUnit know we are expecting them and it's fine to continue
|
||||
$legacy_keys = array(
|
||||
$legacy_keys = array(
|
||||
'id',
|
||||
'exists',
|
||||
'coupon_custom_fields',
|
||||
|
@ -92,7 +92,7 @@ class WC_Tests_Coupon_Data extends WC_Unit_Test_Case {
|
|||
* @since 3.0.0
|
||||
*/
|
||||
public function test_read_manual_coupon() {
|
||||
$code = 'manual_coupon_' . time();
|
||||
$code = 'manual_coupon_' . time();
|
||||
$coupon = new WC_Coupon( $code );
|
||||
$coupon->read_manual_coupon( $code, array(
|
||||
'id' => true,
|
||||
|
@ -122,10 +122,16 @@ class WC_Tests_Coupon_Data extends WC_Unit_Test_Case {
|
|||
* setting these values this way will also throw a deprecated notice so we will let
|
||||
* PHPUnit know that its okay to continue.
|
||||
*/
|
||||
$legacy_keys = array( 'product_ids', 'exclude_product_ids', 'individual_use', 'free_shipping', 'exclude_sale_items' );
|
||||
$legacy_keys = array(
|
||||
'product_ids',
|
||||
'exclude_product_ids',
|
||||
'individual_use',
|
||||
'free_shipping',
|
||||
'exclude_sale_items',
|
||||
);
|
||||
$this->expected_doing_it_wrong = array_merge( $this->expected_doing_it_wrong, $legacy_keys );
|
||||
$code = 'bc_manual_coupon_' . time();
|
||||
$coupon = new WC_Coupon( $code );
|
||||
$code = 'bc_manual_coupon_' . time();
|
||||
$coupon = new WC_Coupon( $code );
|
||||
$coupon->read_manual_coupon( $code, array(
|
||||
'id' => true,
|
||||
'type' => 'fixed_cart',
|
||||
|
@ -157,32 +163,31 @@ class WC_Tests_Coupon_Data extends WC_Unit_Test_Case {
|
|||
* @since 3.0.0
|
||||
*/
|
||||
public function test_coupon_getters_and_setters() {
|
||||
$time = time();
|
||||
$standard_getters_and_setters = array(
|
||||
'code' => 'test',
|
||||
'description' => 'hello world',
|
||||
'discount_type' => 'percent',
|
||||
'amount' => 10.50,
|
||||
'usage_count' => 5,
|
||||
'individual_use' => true,
|
||||
'product_ids' => array( 5, 10 ),
|
||||
'exclude_product_ids' => array( 2, 1 ),
|
||||
'usage_limit' => 2,
|
||||
'usage_limit_per_user' => 10,
|
||||
'limit_usage_to_x_items' => 2,
|
||||
'free_shipping' => true,
|
||||
'product_categories' => array( 6 ),
|
||||
'code' => 'test',
|
||||
'description' => 'hello world',
|
||||
'discount_type' => 'percent',
|
||||
'amount' => 10.50,
|
||||
'usage_count' => 5,
|
||||
'individual_use' => true,
|
||||
'product_ids' => array( 5, 10 ),
|
||||
'exclude_product_ids' => array( 2, 1 ),
|
||||
'usage_limit' => 2,
|
||||
'usage_limit_per_user' => 10,
|
||||
'limit_usage_to_x_items' => 2,
|
||||
'free_shipping' => true,
|
||||
'product_categories' => array( 6 ),
|
||||
'exclude_product_categories' => array( 8 ),
|
||||
'exclude_sale_items' => true,
|
||||
'minimum_amount' => 2,
|
||||
'maximum_amount' => 1000,
|
||||
'customer_email' => array( 'test@woo.local' ),
|
||||
'used_by' => array( 1 ),
|
||||
'exclude_sale_items' => true,
|
||||
'minimum_amount' => 2,
|
||||
'maximum_amount' => 1000,
|
||||
'customer_email' => array( 'test@woo.local' ),
|
||||
'used_by' => array( 1 ),
|
||||
);
|
||||
|
||||
$coupon = new WC_Coupon;
|
||||
foreach ( $standard_getters_and_setters as $function => $value ) {
|
||||
$function = $this->get_function_name( $function );
|
||||
$coupon = new WC_Coupon();
|
||||
foreach ( $standard_getters_and_setters as $function => $value ) {
|
||||
$function = $this->get_function_name( $function );
|
||||
$coupon->{"set_{$function}"}( $value );
|
||||
$this->assertEquals( $value, $coupon->{"get_{$function}"}(), $function );
|
||||
}
|
||||
|
@ -199,7 +204,7 @@ class WC_Tests_Coupon_Data extends WC_Unit_Test_Case {
|
|||
$coupon->add_meta_data( 'test_coupon_field', $meta_value, true );
|
||||
$coupon->save_meta_data();
|
||||
|
||||
$coupon = new WC_Coupon( $coupon_id );
|
||||
$coupon = new WC_Coupon( $coupon_id );
|
||||
$custom_fields = $coupon->get_meta_data();
|
||||
$this->assertCount( 1, $custom_fields );
|
||||
$this->assertEquals( $meta_value, $coupon->get_meta( 'test_coupon_field' ) );
|
||||
|
|
|
@ -40,7 +40,7 @@ class WC_Tests_Functions extends WC_Unit_Test_Case {
|
|||
* @since 2.5.0
|
||||
*/
|
||||
public function test_wc_coupons_enabled() {
|
||||
$this->assertEquals( apply_filters( 'woocommerce_coupons_enabled', get_option( 'woocommerce_enable_coupons' ) == 'yes' ), wc_coupons_enabled() );
|
||||
$this->assertEquals( apply_filters( 'woocommerce_coupons_enabled', get_option( 'woocommerce_enable_coupons' ) === 'yes' ), wc_coupons_enabled() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -454,19 +454,19 @@ class WC_Tests_Formatting_Functions extends WC_Unit_Test_Case {
|
|||
$currency_pos = get_option( 'woocommerce_currency_pos' );
|
||||
|
||||
// Default format (left).
|
||||
$this->assertEquals( '%1$s‎%2$s', get_woocommerce_price_format() );
|
||||
$this->assertEquals( '%1$s%2$s', get_woocommerce_price_format() );
|
||||
|
||||
// Right.
|
||||
update_option( 'woocommerce_currency_pos', 'right' );
|
||||
$this->assertEquals( '%2$s%1$s‏', get_woocommerce_price_format() );
|
||||
$this->assertEquals( '%2$s%1$s', get_woocommerce_price_format() );
|
||||
|
||||
// Left space.
|
||||
update_option( 'woocommerce_currency_pos', 'left_space' );
|
||||
$this->assertEquals( '%1$s‎ %2$s', get_woocommerce_price_format() );
|
||||
$this->assertEquals( '%1$s %2$s', get_woocommerce_price_format() );
|
||||
|
||||
// Right space.
|
||||
update_option( 'woocommerce_currency_pos', 'right_space' );
|
||||
$this->assertEquals( '%2$s %1$s‏', get_woocommerce_price_format() );
|
||||
$this->assertEquals( '%2$s %1$s', get_woocommerce_price_format() );
|
||||
|
||||
// Restore default.
|
||||
update_option( 'woocommerce_currency_pos', $currency_pos );
|
||||
|
@ -542,32 +542,32 @@ class WC_Tests_Formatting_Functions extends WC_Unit_Test_Case {
|
|||
*/
|
||||
public function test_wc_price() {
|
||||
// Common prices.
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>‎1.00</span>', wc_price( 1 ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>‎1.10</span>', wc_price( 1.1 ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>‎1.17</span>', wc_price( 1.17 ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>‎1,111.17</span>', wc_price( 1111.17 ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>‎0.00</span>', wc_price( 0 ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>1.00</span>', wc_price( 1 ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>1.10</span>', wc_price( 1.1 ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>1.17</span>', wc_price( 1.17 ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>1,111.17</span>', wc_price( 1111.17 ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>0.00</span>', wc_price( 0 ) );
|
||||
|
||||
// Different currency.
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>‎1,111.17</span>', wc_price( 1111.17, array( 'currency' => 'USD' ) ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>1,111.17</span>', wc_price( 1111.17, array( 'currency' => 'USD' ) ) );
|
||||
|
||||
// Negative price.
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount">-<span class="woocommerce-Price-currencySymbol">£</span>‎1.17</span>', wc_price( -1.17 ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount">-<span class="woocommerce-Price-currencySymbol">£</span>1.17</span>', wc_price( -1.17 ) );
|
||||
|
||||
// Bogus prices.
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>‎0.00</span>', wc_price( null ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>‎0.00</span>', wc_price( 'Q' ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>‎0.00</span>', wc_price( 'ಠ_ಠ' ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>0.00</span>', wc_price( null ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>0.00</span>', wc_price( 'Q' ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>0.00</span>', wc_price( 'ಠ_ಠ' ) );
|
||||
|
||||
// Trim zeros.
|
||||
add_filter( 'woocommerce_price_trim_zeros', '__return_true' );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>‎1</span>', wc_price( 1.00 ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>1</span>', wc_price( 1.00 ) );
|
||||
remove_filter( 'woocommerce_price_trim_zeros', '__return_true' );
|
||||
|
||||
// Ex tax label.
|
||||
$calc_taxes = get_option( 'woocommerce_calc_taxes' );
|
||||
update_option( 'woocommerce_calc_taxes', 'yes' );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>‎1,111.17</span> <small class="woocommerce-Price-taxLabel tax_label">(ex. VAT)</small>', wc_price( '1111.17', array( 'ex_tax_label' => true ) ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>1,111.17</span> <small class="woocommerce-Price-taxLabel tax_label">(ex. VAT)</small>', wc_price( '1111.17', array( 'ex_tax_label' => true ) ) );
|
||||
update_option( 'woocommerce_calc_taxes', $calc_taxes );
|
||||
}
|
||||
|
||||
|
@ -846,7 +846,7 @@ class WC_Tests_Formatting_Functions extends WC_Unit_Test_Case {
|
|||
* @since 3.3.0
|
||||
*/
|
||||
public function test_wc_format_sale_price() {
|
||||
$this->assertEquals( '<del><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>‎10.00</span></del> <ins><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>‎5.00</span></ins>', wc_format_sale_price( '10', '5' ) );
|
||||
$this->assertEquals( '<del><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>10.00</span></del> <ins><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>5.00</span></ins>', wc_format_sale_price( '10', '5' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -855,7 +855,7 @@ class WC_Tests_Formatting_Functions extends WC_Unit_Test_Case {
|
|||
* @since 3.3.0
|
||||
*/
|
||||
public function test_wc_format_price_range() {
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>‎10.00</span> – <span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>‎5.00</span>', wc_format_price_range( '10', '5' ) );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>10.00</span> – <span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>5.00</span>', wc_format_price_range( '10', '5' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -901,7 +901,7 @@ class WC_Tests_CRUD_Orders extends WC_Unit_Test_Case {
|
|||
$object = new WC_Order();
|
||||
$object->set_total( 100 );
|
||||
$object->set_currency( 'USD' );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>‎100.00</span>', $object->get_formatted_order_total() );
|
||||
$this->assertEquals( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>100.00</span>', $object->get_formatted_order_total() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue