Merge branch 'master' of https://github.com/woocommerce/woocommerce
This commit is contained in:
commit
1d733236e0
|
@ -44,10 +44,11 @@ https://woocommerce.com/contact-us/
|
|||
|
||||
## Coding Guidelines
|
||||
|
||||
- **Ensure you stick to the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/coding-standards/php/)**
|
||||
- **Ensure you stick to the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/)**
|
||||
- Install our pre-commit hook using composer. It'll help with the Coding Standards. To install run `composer install` from the command line within the woocommerce plugin directory.
|
||||
- Ensure you use LF line endings in your code editor. Use [EditorConfig](http://editorconfig.org/) if your editor supports it so that indentation, line endings and other settings are auto configured.
|
||||
- When committing, reference your issue number (#1234) and include a note about the fix.
|
||||
- Ensure that your code is compatible with PHP 5.2+.
|
||||
- Push the changes to your fork and submit a pull request on the master branch of the WooCommerce repository. Existing maintenance branches will be maintained by WooCommerce developers.
|
||||
|
||||
Please **don't** modify the changelog or update the .pot files. These will be maintained by the WooCommerce team.
|
||||
|
|
|
@ -46,3 +46,6 @@ tests/cli/vendor
|
|||
# Composer
|
||||
/vendor/
|
||||
contributors.md
|
||||
|
||||
# Screenshots for e2e tests failures
|
||||
/screenshots/
|
||||
|
|
19
Gruntfile.js
19
Gruntfile.js
|
@ -101,16 +101,9 @@ module.exports = function( grunt ) {
|
|||
ext: '.min.js'
|
||||
}]
|
||||
},
|
||||
simplify_commerce: {
|
||||
flexslider: {
|
||||
files: [{
|
||||
expand: true,
|
||||
cwd: 'includes/gateways/simplify-commerce/assets/js/',
|
||||
src: [
|
||||
'*.js',
|
||||
'!*.min.js'
|
||||
],
|
||||
dest: 'includes/gateways/simplify-commerce/assets/js/',
|
||||
ext: '.min.js'
|
||||
'<%= dirs.js %>/flexslider/jquery.flexslider.min.js': ['<%= dirs.js %>/flexslider/jquery.flexslider.js']
|
||||
}]
|
||||
}
|
||||
},
|
||||
|
@ -284,12 +277,11 @@ module.exports = function( grunt ) {
|
|||
{
|
||||
config: 'authToken',
|
||||
type: 'input',
|
||||
message: '(optional) Provide a personal access token. This will allow 5000 requests per hour rather than 60 - use if nothing is generated.',
|
||||
default: ''
|
||||
message: '(optional) Provide a personal access token. This will allow 5000 requests per hour rather than 60 - use if nothing is generated.'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
// Clean the directory.
|
||||
|
@ -367,7 +359,8 @@ module.exports = function( grunt ) {
|
|||
grunt.registerTask( 'js', [
|
||||
'jshint',
|
||||
'uglify:admin',
|
||||
'uglify:frontend'
|
||||
'uglify:frontend',
|
||||
'uglify:flexslider'
|
||||
]);
|
||||
|
||||
grunt.registerTask( 'css', [
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
12583
assets/css/admin.scss
12583
assets/css/admin.scss
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -413,8 +413,8 @@ table.variations {
|
|||
.flex-control-thumbs {
|
||||
li {
|
||||
list-style: none;
|
||||
float: left;
|
||||
cursor: pointer;
|
||||
float: left;
|
||||
}
|
||||
|
||||
img {
|
||||
|
@ -429,6 +429,8 @@ table.variations {
|
|||
|
||||
img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1711,14 +1711,11 @@ p.demo_store,
|
|||
/**
|
||||
* Right to left styles
|
||||
*/
|
||||
.rtl.woocommerce div.product div.images .flex-control-thumbs li {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.rtl.woocommerce .price_label span {
|
||||
unicode-bidi: embed;
|
||||
.rtl.woocommerce .price_label,
|
||||
.rtl.woocommerce .price_label span {
|
||||
/* rtl:ignore */
|
||||
direction: ltr;
|
||||
direction: ltr;
|
||||
unicode-bidi: embed;
|
||||
}
|
||||
|
||||
.woocommerce-message {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,127 +1,172 @@
|
|||
/* global woocommerce_settings_params */
|
||||
( function( $ ) {
|
||||
/* global woocommerce_settings_params, wp */
|
||||
( function( $, params, wp ) {
|
||||
$( function() {
|
||||
// Sell Countries
|
||||
$( 'select#woocommerce_allowed_countries' ).change( function() {
|
||||
if ( 'specific' === $( this ).val() ) {
|
||||
$( this ).closest('tr').next( 'tr' ).hide();
|
||||
$( this ).closest('tr').next().next( 'tr' ).show();
|
||||
} else if ( 'all_except' === $( this ).val() ) {
|
||||
$( this ).closest('tr').next( 'tr' ).show();
|
||||
$( this ).closest('tr').next().next( 'tr' ).hide();
|
||||
} else {
|
||||
$( this ).closest('tr').next( 'tr' ).hide();
|
||||
$( this ).closest('tr').next().next( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
|
||||
// Sell Countries
|
||||
$( 'select#woocommerce_allowed_countries' ).change( function() {
|
||||
if ( 'specific' === $( this ).val() ) {
|
||||
$( this ).closest('tr').next( 'tr' ).hide();
|
||||
$( this ).closest('tr').next().next( 'tr' ).show();
|
||||
} else if ( 'all_except' === $( this ).val() ) {
|
||||
$( this ).closest('tr').next( 'tr' ).show();
|
||||
$( this ).closest('tr').next().next( 'tr' ).hide();
|
||||
} else {
|
||||
$( this ).closest('tr').next( 'tr' ).hide();
|
||||
$( this ).closest('tr').next().next( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
// Ship Countries
|
||||
$( 'select#woocommerce_ship_to_countries' ).change( function() {
|
||||
if ( 'specific' === $( this ).val() ) {
|
||||
$( this ).closest('tr').next( 'tr' ).show();
|
||||
} else {
|
||||
$( this ).closest('tr').next( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
|
||||
// Ship Countries
|
||||
$( 'select#woocommerce_ship_to_countries' ).change( function() {
|
||||
if ( 'specific' === $( this ).val() ) {
|
||||
$( this ).closest('tr').next( 'tr' ).show();
|
||||
} else {
|
||||
$( this ).closest('tr').next( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
// Stock management
|
||||
$( 'input#woocommerce_manage_stock' ).change( function() {
|
||||
if ( $( this ).is(':checked') ) {
|
||||
$( this ).closest('tbody').find( '.manage_stock_field' ).closest( 'tr' ).show();
|
||||
} else {
|
||||
$( this ).closest('tbody').find( '.manage_stock_field' ).closest( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
|
||||
// Stock management
|
||||
$( 'input#woocommerce_manage_stock' ).change( function() {
|
||||
if ( $( this ).is(':checked') ) {
|
||||
$( this ).closest('tbody').find( '.manage_stock_field' ).closest( 'tr' ).show();
|
||||
} else {
|
||||
$( this ).closest('tbody').find( '.manage_stock_field' ).closest( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
// Color picker
|
||||
$( '.colorpick' )
|
||||
|
||||
// Color picker
|
||||
$( '.colorpick' )
|
||||
.iris({
|
||||
change: function( event, ui ) {
|
||||
$( this ).parent().find( '.colorpickpreview' ).css({ backgroundColor: ui.color.toString() });
|
||||
},
|
||||
hide: true,
|
||||
border: true
|
||||
})
|
||||
|
||||
.iris({
|
||||
change: function( event, ui ) {
|
||||
$( this ).parent().find( '.colorpickpreview' ).css({ backgroundColor: ui.color.toString() });
|
||||
},
|
||||
hide: true,
|
||||
border: true
|
||||
})
|
||||
.on( 'click focus', function( event ) {
|
||||
event.stopPropagation();
|
||||
$( '.iris-picker' ).hide();
|
||||
$( this ).closest( 'td' ).find( '.iris-picker' ).show();
|
||||
$( this ).data( 'original-value', $( this ).val() );
|
||||
})
|
||||
|
||||
.on( 'click focus', function( event ) {
|
||||
event.stopPropagation();
|
||||
.on( 'change', function() {
|
||||
if ( $( this ).is( '.iris-error' ) ) {
|
||||
var original_value = $( this ).data( 'original-value' );
|
||||
|
||||
if ( original_value.match( /^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/ ) ) {
|
||||
$( this ).val( $( this ).data( 'original-value' ) ).change();
|
||||
} else {
|
||||
$( this ).val( '' ).change();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', function() {
|
||||
$( '.iris-picker' ).hide();
|
||||
$( this ).closest( 'td' ).find( '.iris-picker' ).show();
|
||||
$( this ).data( 'original-value', $( this ).val() );
|
||||
})
|
||||
});
|
||||
|
||||
.on( 'change', function() {
|
||||
if ( $( this ).is( '.iris-error' ) ) {
|
||||
var original_value = $( this ).data( 'original-value' );
|
||||
// Edit prompt
|
||||
$( function() {
|
||||
var changed = false;
|
||||
|
||||
if ( original_value.match( /^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/ ) ) {
|
||||
$( this ).val( $( this ).data( 'original-value' ) ).change();
|
||||
$( 'input, textarea, select, checkbox' ).change( function() {
|
||||
changed = true;
|
||||
});
|
||||
|
||||
$( '.woo-nav-tab-wrapper a' ).click( function() {
|
||||
if ( changed ) {
|
||||
window.onbeforeunload = function() {
|
||||
return params.i18n_nav_warning;
|
||||
};
|
||||
} else {
|
||||
$( this ).val( '' ).change();
|
||||
window.onbeforeunload = '';
|
||||
}
|
||||
});
|
||||
|
||||
$( '.submit :input' ).click( function() {
|
||||
window.onbeforeunload = '';
|
||||
});
|
||||
});
|
||||
|
||||
// Sorting
|
||||
$( 'table.wc_gateways tbody, table.wc_shipping tbody' ).sortable({
|
||||
items: 'tr',
|
||||
cursor: 'move',
|
||||
axis: 'y',
|
||||
handle: 'td.sort',
|
||||
scrollSensitivity: 40,
|
||||
helper: function( event, ui ) {
|
||||
ui.children().each( function() {
|
||||
$( this ).width( $( this ).width() );
|
||||
});
|
||||
ui.css( 'left', '0' );
|
||||
return ui;
|
||||
},
|
||||
start: function( event, ui ) {
|
||||
ui.item.css( 'background-color', '#f6f6f6' );
|
||||
},
|
||||
stop: function( event, ui ) {
|
||||
ui.item.removeAttr( 'style' );
|
||||
ui.item.trigger( 'updateMoveButtons' );
|
||||
}
|
||||
});
|
||||
|
||||
// Select all/none
|
||||
$( '.woocommerce' ).on( 'click', '.select_all', function() {
|
||||
$( this ).closest( 'td' ).find( 'select option' ).attr( 'selected', 'selected' );
|
||||
$( this ).closest( 'td' ).find( 'select' ).trigger( 'change' );
|
||||
return false;
|
||||
});
|
||||
|
||||
$( '.woocommerce' ).on( 'click', '.select_none', function() {
|
||||
$( this ).closest( 'td' ).find( 'select option' ).removeAttr( 'selected' );
|
||||
$( this ).closest( 'td' ).find( 'select' ).trigger( 'change' );
|
||||
return false;
|
||||
});
|
||||
|
||||
// Re-order buttons.
|
||||
$( '.wc-item-reorder-nav').find( '.wc-move-up, .wc-move-down' ).on( 'click', function() {
|
||||
var moveBtn = $( this ),
|
||||
$row = moveBtn.closest( 'tr' );
|
||||
|
||||
moveBtn.focus();
|
||||
|
||||
var isMoveUp = moveBtn.is( '.wc-move-up' ),
|
||||
isMoveDown = moveBtn.is( '.wc-move-down' );
|
||||
|
||||
if ( isMoveUp ) {
|
||||
var $previewRow = $row.prev( 'tr' );
|
||||
|
||||
if ( $previewRow && $previewRow.length ) {
|
||||
$previewRow.before( $row );
|
||||
wp.a11y.speak( params.i18n_moved_up );
|
||||
}
|
||||
} else if ( isMoveDown ) {
|
||||
var $nextRow = $row.next( 'tr' );
|
||||
|
||||
if ( $nextRow && $nextRow.length ) {
|
||||
$nextRow.after( $row );
|
||||
wp.a11y.speak( params.i18n_moved_down );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', function() {
|
||||
$( '.iris-picker' ).hide();
|
||||
moveBtn.focus(); // Re-focus after the container was moved.
|
||||
moveBtn.closest( 'table' ).trigger( 'updateMoveButtons' );
|
||||
} );
|
||||
|
||||
$( '.wc-item-reorder-nav').closest( 'table' ).on( 'updateMoveButtons', function() {
|
||||
var table = $( this ),
|
||||
lastRow = $( this ).find( 'tbody tr:last' ),
|
||||
firstRow = $( this ).find( 'tbody tr:first' );
|
||||
|
||||
table.find( '.wc-item-reorder-nav .wc-move-disabled' ).removeClass( 'wc-move-disabled' ).attr( { 'tabindex': '0', 'aria-hidden': 'false' } );
|
||||
firstRow.find( '.wc-item-reorder-nav .wc-move-up' ).addClass( 'wc-move-disabled' ).attr( { 'tabindex': '-1', 'aria-hidden': 'true' } );
|
||||
lastRow.find( '.wc-item-reorder-nav .wc-move-down' ).addClass( 'wc-move-disabled' ).attr( { 'tabindex': '-1', 'aria-hidden': 'true' } );
|
||||
} );
|
||||
|
||||
$( '.wc-item-reorder-nav').closest( 'table' ).trigger( 'updateMoveButtons' );
|
||||
|
||||
});
|
||||
|
||||
// Edit prompt
|
||||
$( function() {
|
||||
var changed = false;
|
||||
|
||||
$( 'input, textarea, select, checkbox' ).change( function() {
|
||||
changed = true;
|
||||
});
|
||||
|
||||
$( '.woo-nav-tab-wrapper a' ).click( function() {
|
||||
if ( changed ) {
|
||||
window.onbeforeunload = function() {
|
||||
return woocommerce_settings_params.i18n_nav_warning;
|
||||
};
|
||||
} else {
|
||||
window.onbeforeunload = '';
|
||||
}
|
||||
});
|
||||
|
||||
$( '.submit :input' ).click( function() {
|
||||
window.onbeforeunload = '';
|
||||
});
|
||||
});
|
||||
|
||||
// Sorting
|
||||
$( 'table.wc_gateways tbody, table.wc_shipping tbody' ).sortable({
|
||||
items: 'tr',
|
||||
cursor: 'move',
|
||||
axis: 'y',
|
||||
handle: 'td.sort',
|
||||
scrollSensitivity: 40,
|
||||
helper: function( event, ui ) {
|
||||
ui.children().each( function() {
|
||||
$( this ).width( $( this ).width() );
|
||||
});
|
||||
ui.css( 'left', '0' );
|
||||
return ui;
|
||||
},
|
||||
start: function( event, ui ) {
|
||||
ui.item.css( 'background-color', '#f6f6f6' );
|
||||
},
|
||||
stop: function( event, ui ) {
|
||||
ui.item.removeAttr( 'style' );
|
||||
}
|
||||
});
|
||||
|
||||
// Select all/none
|
||||
$( '.woocommerce' ).on( 'click', '.select_all', function() {
|
||||
$( this ).closest( 'td' ).find( 'select option' ).attr( 'selected', 'selected' );
|
||||
$( this ).closest( 'td' ).find( 'select' ).trigger( 'change' );
|
||||
return false;
|
||||
});
|
||||
|
||||
$( '.woocommerce' ).on( 'click', '.select_none', function() {
|
||||
$( this ).closest( 'td' ).find( 'select option' ).removeAttr( 'selected' );
|
||||
$( this ).closest( 'td' ).find( 'select' ).trigger( 'change' );
|
||||
return false;
|
||||
});
|
||||
})( jQuery );
|
||||
})( jQuery, woocommerce_settings_params, wp );
|
||||
|
|
|
@ -1 +1 @@
|
|||
!function(t){t("select#woocommerce_allowed_countries").change(function(){"specific"===t(this).val()?(t(this).closest("tr").next("tr").hide(),t(this).closest("tr").next().next("tr").show()):"all_except"===t(this).val()?(t(this).closest("tr").next("tr").show(),t(this).closest("tr").next().next("tr").hide()):(t(this).closest("tr").next("tr").hide(),t(this).closest("tr").next().next("tr").hide())}).change(),t("select#woocommerce_ship_to_countries").change(function(){"specific"===t(this).val()?t(this).closest("tr").next("tr").show():t(this).closest("tr").next("tr").hide()}).change(),t("input#woocommerce_manage_stock").change(function(){t(this).is(":checked")?t(this).closest("tbody").find(".manage_stock_field").closest("tr").show():t(this).closest("tbody").find(".manage_stock_field").closest("tr").hide()}).change(),t(".colorpick").iris({change:function(e,i){t(this).parent().find(".colorpickpreview").css({backgroundColor:i.color.toString()})},hide:!0,border:!0}).on("click focus",function(e){e.stopPropagation(),t(".iris-picker").hide(),t(this).closest("td").find(".iris-picker").show(),t(this).data("original-value",t(this).val())}).on("change",function(){t(this).is(".iris-error")&&(t(this).data("original-value").match(/^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/)?t(this).val(t(this).data("original-value")).change():t(this).val("").change())}),t("body").on("click",function(){t(".iris-picker").hide()}),t(function(){var e=!1;t("input, textarea, select, checkbox").change(function(){e=!0}),t(".woo-nav-tab-wrapper a").click(function(){window.onbeforeunload=e?function(){return woocommerce_settings_params.i18n_nav_warning}:""}),t(".submit input").click(function(){window.onbeforeunload=""})}),t("table.wc_gateways tbody, table.wc_shipping tbody").sortable({items:"tr",cursor:"move",axis:"y",handle:"td.sort",scrollSensitivity:40,helper:function(e,i){return i.children().each(function(){t(this).width(t(this).width())}),i.css("left","0"),i},start:function(t,e){e.item.css("background-color","#f6f6f6")},stop:function(t,e){e.item.removeAttr("style")}}),t(".woocommerce").on("click",".select_all",function(){return t(this).closest("td").find("select option").attr("selected","selected"),t(this).closest("td").find("select").trigger("change"),!1}),t(".woocommerce").on("click",".select_none",function(){return t(this).closest("td").find("select option").removeAttr("selected"),t(this).closest("td").find("select").trigger("change"),!1})}(jQuery);
|
||||
!function(t,e,i){t(function(){t("select#woocommerce_allowed_countries").change(function(){"specific"===t(this).val()?(t(this).closest("tr").next("tr").hide(),t(this).closest("tr").next().next("tr").show()):"all_except"===t(this).val()?(t(this).closest("tr").next("tr").show(),t(this).closest("tr").next().next("tr").hide()):(t(this).closest("tr").next("tr").hide(),t(this).closest("tr").next().next("tr").hide())}).change(),t("select#woocommerce_ship_to_countries").change(function(){"specific"===t(this).val()?t(this).closest("tr").next("tr").show():t(this).closest("tr").next("tr").hide()}).change(),t("input#woocommerce_manage_stock").change(function(){t(this).is(":checked")?t(this).closest("tbody").find(".manage_stock_field").closest("tr").show():t(this).closest("tbody").find(".manage_stock_field").closest("tr").hide()}).change(),t(".colorpick").iris({change:function(e,i){t(this).parent().find(".colorpickpreview").css({backgroundColor:i.color.toString()})},hide:!0,border:!0}).on("click focus",function(e){e.stopPropagation(),t(".iris-picker").hide(),t(this).closest("td").find(".iris-picker").show(),t(this).data("original-value",t(this).val())}).on("change",function(){t(this).is(".iris-error")&&(t(this).data("original-value").match(/^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/)?t(this).val(t(this).data("original-value")).change():t(this).val("").change())}),t("body").on("click",function(){t(".iris-picker").hide()}),t(function(){var i=!1;t("input, textarea, select, checkbox").change(function(){i=!0}),t(".woo-nav-tab-wrapper a").click(function(){window.onbeforeunload=i?function(){return e.i18n_nav_warning}:""}),t(".submit :input").click(function(){window.onbeforeunload=""})}),t("table.wc_gateways tbody, table.wc_shipping tbody").sortable({items:"tr",cursor:"move",axis:"y",handle:"td.sort",scrollSensitivity:40,helper:function(e,i){return i.children().each(function(){t(this).width(t(this).width())}),i.css("left","0"),i},start:function(t,e){e.item.css("background-color","#f6f6f6")},stop:function(t,e){e.item.removeAttr("style"),e.item.trigger("updateMoveButtons")}}),t(".woocommerce").on("click",".select_all",function(){return t(this).closest("td").find("select option").attr("selected","selected"),t(this).closest("td").find("select").trigger("change"),!1}),t(".woocommerce").on("click",".select_none",function(){return t(this).closest("td").find("select option").removeAttr("selected"),t(this).closest("td").find("select").trigger("change"),!1}),t(".wc-item-reorder-nav").find(".wc-move-up, .wc-move-down").on("click",function(){var o=t(this),s=o.closest("tr");o.focus();var n=o.is(".wc-move-up"),c=o.is(".wc-move-down");if(n){var r=s.prev("tr");r&&r.length&&(r.before(s),i.a11y.speak(e.i18n_moved_up))}else if(c){var a=s.next("tr");a&&a.length&&(a.after(s),i.a11y.speak(e.i18n_moved_down))}o.focus(),o.closest("table").trigger("updateMoveButtons")}),t(".wc-item-reorder-nav").closest("table").on("updateMoveButtons",function(){var e=t(this),i=t(this).find("tbody tr:last"),o=t(this).find("tbody tr:first");e.find(".wc-item-reorder-nav .wc-move-disabled").removeClass("wc-move-disabled").attr({tabindex:"0","aria-hidden":"false"}),o.find(".wc-item-reorder-nav .wc-move-up").addClass("wc-move-disabled").attr({tabindex:"-1","aria-hidden":"true"}),i.find(".wc-item-reorder-nav .wc-move-down").addClass("wc-move-disabled").attr({tabindex:"-1","aria-hidden":"true"})}),t(".wc-item-reorder-nav").closest("table").trigger("updateMoveButtons")})}(jQuery,woocommerce_settings_params,wp);
|
|
@ -1,338 +1,338 @@
|
|||
/* global woocommerce_admin */
|
||||
jQuery( function ( $ ) {
|
||||
|
||||
if ( 'undefined' === typeof woocommerce_admin ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add buttons to product screen.
|
||||
var $product_screen = $( '.edit-php.post-type-product' ),
|
||||
$title_action = $product_screen.find( '.page-title-action:first' ),
|
||||
$blankslate = $product_screen.find( '.woocommerce-BlankState' );
|
||||
|
||||
if ( 0 === $blankslate.length ) {
|
||||
if ( woocommerce_admin.urls.export_products ) {
|
||||
$title_action.after('<a href="' + woocommerce_admin.urls.export_products + '" class="page-title-action">' + woocommerce_admin.strings.export_products + '</a>');
|
||||
( function( $, woocommerce_admin ) {
|
||||
$( function() {
|
||||
if ( 'undefined' === typeof woocommerce_admin ) {
|
||||
return;
|
||||
}
|
||||
if ( woocommerce_admin.urls.import_products ) {
|
||||
$title_action.after( '<a href="' + woocommerce_admin.urls.import_products + '" class="page-title-action">' + woocommerce_admin.strings.import_products + '</a>' );
|
||||
|
||||
// Add buttons to product screen.
|
||||
var $product_screen = $( '.edit-php.post-type-product' ),
|
||||
$title_action = $product_screen.find( '.page-title-action:first' ),
|
||||
$blankslate = $product_screen.find( '.woocommerce-BlankState' );
|
||||
|
||||
if ( 0 === $blankslate.length ) {
|
||||
if ( woocommerce_admin.urls.export_products ) {
|
||||
$title_action.after('<a href="' + woocommerce_admin.urls.export_products + '" class="page-title-action">' + woocommerce_admin.strings.export_products + '</a>');
|
||||
}
|
||||
if ( woocommerce_admin.urls.import_products ) {
|
||||
$title_action.after( '<a href="' + woocommerce_admin.urls.import_products + '" class="page-title-action">' + woocommerce_admin.strings.import_products + '</a>' );
|
||||
}
|
||||
} else {
|
||||
$title_action.hide();
|
||||
}
|
||||
} else {
|
||||
$title_action.hide();
|
||||
}
|
||||
|
||||
// Progress indicators when showing steps.
|
||||
$( '.woocommerce-progress-form-wrapper .button-next' ).on( 'click', function() {
|
||||
$('.wc-progress-form-content').block({
|
||||
message: null,
|
||||
overlayCSS: {
|
||||
background: '#fff',
|
||||
opacity: 0.6
|
||||
}
|
||||
});
|
||||
return true;
|
||||
} );
|
||||
// Progress indicators when showing steps.
|
||||
$( '.woocommerce-progress-form-wrapper .button-next' ).on( 'click', function() {
|
||||
$('.wc-progress-form-content').block({
|
||||
message: null,
|
||||
overlayCSS: {
|
||||
background: '#fff',
|
||||
opacity: 0.6
|
||||
}
|
||||
});
|
||||
return true;
|
||||
} );
|
||||
|
||||
// Field validation error tips
|
||||
$( document.body )
|
||||
// Field validation error tips
|
||||
$( document.body )
|
||||
|
||||
.on( 'wc_add_error_tip', function( e, element, error_type ) {
|
||||
var offset = element.position();
|
||||
.on( 'wc_add_error_tip', function( e, element, error_type ) {
|
||||
var offset = element.position();
|
||||
|
||||
if ( element.parent().find( '.wc_error_tip' ).length === 0 ) {
|
||||
element.after( '<div class="wc_error_tip ' + error_type + '">' + woocommerce_admin[error_type] + '</div>' );
|
||||
element.parent().find( '.wc_error_tip' )
|
||||
.css( 'left', offset.left + element.width() - ( element.width() / 2 ) - ( $( '.wc_error_tip' ).width() / 2 ) )
|
||||
.css( 'top', offset.top + element.height() )
|
||||
.fadeIn( '100' );
|
||||
}
|
||||
})
|
||||
if ( element.parent().find( '.wc_error_tip' ).length === 0 ) {
|
||||
element.after( '<div class="wc_error_tip ' + error_type + '">' + woocommerce_admin[error_type] + '</div>' );
|
||||
element.parent().find( '.wc_error_tip' )
|
||||
.css( 'left', offset.left + element.width() - ( element.width() / 2 ) - ( $( '.wc_error_tip' ).width() / 2 ) )
|
||||
.css( 'top', offset.top + element.height() )
|
||||
.fadeIn( '100' );
|
||||
}
|
||||
})
|
||||
|
||||
.on( 'wc_remove_error_tip', function( e, element, error_type ) {
|
||||
element.parent().find( '.wc_error_tip.' + error_type ).fadeOut( '100', function() { $( this ).remove(); } );
|
||||
})
|
||||
.on( 'wc_remove_error_tip', function( e, element, error_type ) {
|
||||
element.parent().find( '.wc_error_tip.' + error_type ).fadeOut( '100', function() { $( this ).remove(); } );
|
||||
})
|
||||
|
||||
.on( 'click', function() {
|
||||
$( '.wc_error_tip' ).fadeOut( '100', function() { $( this ).remove(); } );
|
||||
})
|
||||
.on( 'click', function() {
|
||||
$( '.wc_error_tip' ).fadeOut( '100', function() { $( this ).remove(); } );
|
||||
})
|
||||
|
||||
.on( 'blur', '.wc_input_decimal[type=text], .wc_input_price[type=text], .wc_input_country_iso[type=text]', function() {
|
||||
$( '.wc_error_tip' ).fadeOut( '100', function() { $( this ).remove(); } );
|
||||
})
|
||||
.on( 'blur', '.wc_input_decimal[type=text], .wc_input_price[type=text], .wc_input_country_iso[type=text]', function() {
|
||||
$( '.wc_error_tip' ).fadeOut( '100', function() { $( this ).remove(); } );
|
||||
})
|
||||
|
||||
.on( 'change', '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc-order-totals #refund_amount[type=text]', function() {
|
||||
var regex;
|
||||
.on( 'change', '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc-order-totals #refund_amount[type=text]', function() {
|
||||
var regex;
|
||||
|
||||
if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) {
|
||||
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.mon_decimal_point + ']+', 'gi' );
|
||||
} else {
|
||||
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.decimal_point + ']+', 'gi' );
|
||||
}
|
||||
if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) {
|
||||
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.mon_decimal_point + ']+', 'gi' );
|
||||
} else {
|
||||
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.decimal_point + ']+', 'gi' );
|
||||
}
|
||||
|
||||
var value = $( this ).val();
|
||||
var newvalue = value.replace( regex, '' );
|
||||
var value = $( this ).val();
|
||||
var newvalue = value.replace( regex, '' );
|
||||
|
||||
if ( value !== newvalue ) {
|
||||
$( this ).val( newvalue );
|
||||
}
|
||||
})
|
||||
if ( value !== newvalue ) {
|
||||
$( this ).val( newvalue );
|
||||
}
|
||||
})
|
||||
|
||||
.on( 'keyup', '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc_input_country_iso[type=text], .wc-order-totals #refund_amount[type=text]', function() {
|
||||
var regex, error;
|
||||
.on( 'keyup', '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc_input_country_iso[type=text], .wc-order-totals #refund_amount[type=text]', function() {
|
||||
var regex, error;
|
||||
|
||||
if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) {
|
||||
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.mon_decimal_point + ']+', 'gi' );
|
||||
error = 'i18n_mon_decimal_error';
|
||||
} else if ( $( this ).is( '.wc_input_country_iso' ) ) {
|
||||
regex = new RegExp( '([^A-Z])+|(.){3,}', 'im' );
|
||||
error = 'i18n_country_iso_error';
|
||||
} else {
|
||||
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.decimal_point + ']+', 'gi' );
|
||||
error = 'i18n_decimal_error';
|
||||
}
|
||||
if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) {
|
||||
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.mon_decimal_point + ']+', 'gi' );
|
||||
error = 'i18n_mon_decimal_error';
|
||||
} else if ( $( this ).is( '.wc_input_country_iso' ) ) {
|
||||
regex = new RegExp( '([^A-Z])+|(.){3,}', 'im' );
|
||||
error = 'i18n_country_iso_error';
|
||||
} else {
|
||||
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.decimal_point + ']+', 'gi' );
|
||||
error = 'i18n_decimal_error';
|
||||
}
|
||||
|
||||
var value = $( this ).val();
|
||||
var newvalue = value.replace( regex, '' );
|
||||
var value = $( this ).val();
|
||||
var newvalue = value.replace( regex, '' );
|
||||
|
||||
if ( value !== newvalue ) {
|
||||
$( document.body ).triggerHandler( 'wc_add_error_tip', [ $( this ), error ] );
|
||||
} else {
|
||||
$( document.body ).triggerHandler( 'wc_remove_error_tip', [ $( this ), error ] );
|
||||
}
|
||||
})
|
||||
if ( value !== newvalue ) {
|
||||
$( document.body ).triggerHandler( 'wc_add_error_tip', [ $( this ), error ] );
|
||||
} else {
|
||||
$( document.body ).triggerHandler( 'wc_remove_error_tip', [ $( this ), error ] );
|
||||
}
|
||||
})
|
||||
|
||||
.on( 'change', '#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]', function() {
|
||||
var sale_price_field = $( this ), regular_price_field;
|
||||
.on( 'change', '#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]', function() {
|
||||
var sale_price_field = $( this ), regular_price_field;
|
||||
|
||||
if( sale_price_field.attr( 'name' ).indexOf( 'variable' ) !== -1 ) {
|
||||
regular_price_field = sale_price_field.parents( '.variable_pricing' ).find( '.wc_input_price[name^=variable_regular_price]' );
|
||||
} else {
|
||||
regular_price_field = $( '#_regular_price' );
|
||||
}
|
||||
if( sale_price_field.attr( 'name' ).indexOf( 'variable' ) !== -1 ) {
|
||||
regular_price_field = sale_price_field.parents( '.variable_pricing' ).find( '.wc_input_price[name^=variable_regular_price]' );
|
||||
} else {
|
||||
regular_price_field = $( '#_regular_price' );
|
||||
}
|
||||
|
||||
var sale_price = parseFloat( window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||
var regular_price = parseFloat( window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||
var sale_price = parseFloat( window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||
var regular_price = parseFloat( window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||
|
||||
if ( sale_price >= regular_price ) {
|
||||
$( this ).val( '' );
|
||||
}
|
||||
})
|
||||
if ( sale_price >= regular_price ) {
|
||||
$( this ).val( '' );
|
||||
}
|
||||
})
|
||||
|
||||
.on( 'keyup', '#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]', function() {
|
||||
var sale_price_field = $( this ), regular_price_field;
|
||||
.on( 'keyup', '#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]', function() {
|
||||
var sale_price_field = $( this ), regular_price_field;
|
||||
|
||||
if( sale_price_field.attr( 'name' ).indexOf( 'variable' ) !== -1 ) {
|
||||
regular_price_field = sale_price_field.parents( '.variable_pricing' ).find( '.wc_input_price[name^=variable_regular_price]' );
|
||||
} else {
|
||||
regular_price_field = $( '#_regular_price' );
|
||||
}
|
||||
if( sale_price_field.attr( 'name' ).indexOf( 'variable' ) !== -1 ) {
|
||||
regular_price_field = sale_price_field.parents( '.variable_pricing' ).find( '.wc_input_price[name^=variable_regular_price]' );
|
||||
} else {
|
||||
regular_price_field = $( '#_regular_price' );
|
||||
}
|
||||
|
||||
var sale_price = parseFloat( window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||
var regular_price = parseFloat( window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||
var sale_price = parseFloat( window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||
var regular_price = parseFloat( window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||
|
||||
if ( sale_price >= regular_price ) {
|
||||
$( document.body ).triggerHandler( 'wc_add_error_tip', [ $(this), 'i18_sale_less_than_regular_error' ] );
|
||||
} else {
|
||||
$( document.body ).triggerHandler( 'wc_remove_error_tip', [ $(this), 'i18_sale_less_than_regular_error' ] );
|
||||
}
|
||||
})
|
||||
if ( sale_price >= regular_price ) {
|
||||
$( document.body ).triggerHandler( 'wc_add_error_tip', [ $(this), 'i18_sale_less_than_regular_error' ] );
|
||||
} else {
|
||||
$( document.body ).triggerHandler( 'wc_remove_error_tip', [ $(this), 'i18_sale_less_than_regular_error' ] );
|
||||
}
|
||||
})
|
||||
|
||||
.on( 'init_tooltips', function() {
|
||||
.on( 'init_tooltips', function() {
|
||||
|
||||
$( '.tips, .help_tip, .woocommerce-help-tip' ).tipTip( {
|
||||
'attribute': 'data-tip',
|
||||
'fadeIn': 50,
|
||||
'fadeOut': 50,
|
||||
'delay': 200
|
||||
} );
|
||||
|
||||
$( '.column-wc_actions .wc-action-button' ).tipTip( {
|
||||
'fadeIn': 50,
|
||||
'fadeOut': 50,
|
||||
'delay': 200
|
||||
} );
|
||||
|
||||
// Add tiptip to parent element for widefat tables
|
||||
$( '.parent-tips' ).each( function() {
|
||||
$( this ).closest( 'a, th' ).attr( 'data-tip', $( this ).data( 'tip' ) ).tipTip( {
|
||||
$( '.tips, .help_tip, .woocommerce-help-tip' ).tipTip( {
|
||||
'attribute': 'data-tip',
|
||||
'fadeIn': 50,
|
||||
'fadeOut': 50,
|
||||
'delay': 200
|
||||
} ).css( 'cursor', 'help' );
|
||||
} );
|
||||
|
||||
$( '.column-wc_actions .wc-action-button' ).tipTip( {
|
||||
'fadeIn': 50,
|
||||
'fadeOut': 50,
|
||||
'delay': 200
|
||||
} );
|
||||
|
||||
// Add tiptip to parent element for widefat tables
|
||||
$( '.parent-tips' ).each( function() {
|
||||
$( this ).closest( 'a, th' ).attr( 'data-tip', $( this ).data( 'tip' ) ).tipTip( {
|
||||
'attribute': 'data-tip',
|
||||
'fadeIn': 50,
|
||||
'fadeOut': 50,
|
||||
'delay': 200
|
||||
} ).css( 'cursor', 'help' );
|
||||
});
|
||||
});
|
||||
|
||||
// Tooltips
|
||||
$( document.body ).trigger( 'init_tooltips' );
|
||||
|
||||
// wc_input_table tables
|
||||
$( '.wc_input_table.sortable tbody' ).sortable({
|
||||
items: 'tr',
|
||||
cursor: 'move',
|
||||
axis: 'y',
|
||||
scrollSensitivity: 40,
|
||||
forcePlaceholderSize: true,
|
||||
helper: 'clone',
|
||||
opacity: 0.65,
|
||||
placeholder: 'wc-metabox-sortable-placeholder',
|
||||
start: function( event, ui ) {
|
||||
ui.item.css( 'background-color', '#f6f6f6' );
|
||||
},
|
||||
stop: function( event, ui ) {
|
||||
ui.item.removeAttr( 'style' );
|
||||
}
|
||||
});
|
||||
// Focus on inputs within the table if clicked instead of trying to sort.
|
||||
$( '.wc_input_table.sortable tbody input' ).on( 'click', function() {
|
||||
$( this ).focus();
|
||||
} );
|
||||
|
||||
$( '.wc_input_table .remove_rows' ).click( function() {
|
||||
var $tbody = $( this ).closest( '.wc_input_table' ).find( 'tbody' );
|
||||
if ( $tbody.find( 'tr.current' ).length > 0 ) {
|
||||
var $current = $tbody.find( 'tr.current' );
|
||||
$current.each( function() {
|
||||
$( this ).remove();
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// Tooltips
|
||||
$( document.body ).trigger( 'init_tooltips' );
|
||||
var controlled = false;
|
||||
var shifted = false;
|
||||
var hasFocus = false;
|
||||
|
||||
// wc_input_table tables
|
||||
$( '.wc_input_table.sortable tbody' ).sortable({
|
||||
items: 'tr',
|
||||
cursor: 'move',
|
||||
axis: 'y',
|
||||
scrollSensitivity: 40,
|
||||
forcePlaceholderSize: true,
|
||||
helper: 'clone',
|
||||
opacity: 0.65,
|
||||
placeholder: 'wc-metabox-sortable-placeholder',
|
||||
start: function( event, ui ) {
|
||||
ui.item.css( 'background-color', '#f6f6f6' );
|
||||
},
|
||||
stop: function( event, ui ) {
|
||||
ui.item.removeAttr( 'style' );
|
||||
}
|
||||
});
|
||||
// Focus on inputs within the table if clicked instead of trying to sort.
|
||||
$( '.wc_input_table.sortable tbody input' ).on( 'click', function() {
|
||||
$( this ).focus();
|
||||
} );
|
||||
$( document.body ).bind( 'keyup keydown', function( e ) {
|
||||
shifted = e.shiftKey;
|
||||
controlled = e.ctrlKey || e.metaKey;
|
||||
});
|
||||
|
||||
$( '.wc_input_table .remove_rows' ).click( function() {
|
||||
var $tbody = $( this ).closest( '.wc_input_table' ).find( 'tbody' );
|
||||
if ( $tbody.find( 'tr.current' ).length > 0 ) {
|
||||
var $current = $tbody.find( 'tr.current' );
|
||||
$current.each( function() {
|
||||
$( this ).remove();
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$( '.wc_input_table' ).on( 'focus click', 'input', function( e ) {
|
||||
var $this_table = $( this ).closest( 'table, tbody' );
|
||||
var $this_row = $( this ).closest( 'tr' );
|
||||
|
||||
var controlled = false;
|
||||
var shifted = false;
|
||||
var hasFocus = false;
|
||||
if ( ( e.type === 'focus' && hasFocus !== $this_row.index() ) || ( e.type === 'click' && $( this ).is( ':focus' ) ) ) {
|
||||
hasFocus = $this_row.index();
|
||||
|
||||
$( document.body ).bind( 'keyup keydown', function( e ) {
|
||||
shifted = e.shiftKey;
|
||||
controlled = e.ctrlKey || e.metaKey;
|
||||
});
|
||||
if ( ! shifted && ! controlled ) {
|
||||
$( 'tr', $this_table ).removeClass( 'current' ).removeClass( 'last_selected' );
|
||||
$this_row.addClass( 'current' ).addClass( 'last_selected' );
|
||||
} else if ( shifted ) {
|
||||
$( 'tr', $this_table ).removeClass( 'current' );
|
||||
$this_row.addClass( 'selected_now' ).addClass( 'current' );
|
||||
|
||||
$( '.wc_input_table' ).on( 'focus click', 'input', function( e ) {
|
||||
var $this_table = $( this ).closest( 'table, tbody' );
|
||||
var $this_row = $( this ).closest( 'tr' );
|
||||
if ( $( 'tr.last_selected', $this_table ).length > 0 ) {
|
||||
if ( $this_row.index() > $( 'tr.last_selected', $this_table ).index() ) {
|
||||
$( 'tr', $this_table ).slice( $( 'tr.last_selected', $this_table ).index(), $this_row.index() ).addClass( 'current' );
|
||||
} else {
|
||||
$( 'tr', $this_table ).slice( $this_row.index(), $( 'tr.last_selected', $this_table ).index() + 1 ).addClass( 'current' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ( e.type === 'focus' && hasFocus !== $this_row.index() ) || ( e.type === 'click' && $( this ).is( ':focus' ) ) ) {
|
||||
hasFocus = $this_row.index();
|
||||
|
||||
if ( ! shifted && ! controlled ) {
|
||||
$( 'tr', $this_table ).removeClass( 'current' ).removeClass( 'last_selected' );
|
||||
$this_row.addClass( 'current' ).addClass( 'last_selected' );
|
||||
} else if ( shifted ) {
|
||||
$( 'tr', $this_table ).removeClass( 'current' );
|
||||
$this_row.addClass( 'selected_now' ).addClass( 'current' );
|
||||
|
||||
if ( $( 'tr.last_selected', $this_table ).length > 0 ) {
|
||||
if ( $this_row.index() > $( 'tr.last_selected', $this_table ).index() ) {
|
||||
$( 'tr', $this_table ).slice( $( 'tr.last_selected', $this_table ).index(), $this_row.index() ).addClass( 'current' );
|
||||
$( 'tr', $this_table ).removeClass( 'last_selected' );
|
||||
$this_row.addClass( 'last_selected' );
|
||||
} else {
|
||||
$( 'tr', $this_table ).removeClass( 'last_selected' );
|
||||
if ( controlled && $( this ).closest( 'tr' ).is( '.current' ) ) {
|
||||
$this_row.removeClass( 'current' );
|
||||
} else {
|
||||
$( 'tr', $this_table ).slice( $this_row.index(), $( 'tr.last_selected', $this_table ).index() + 1 ).addClass( 'current' );
|
||||
$this_row.addClass( 'current' ).addClass( 'last_selected' );
|
||||
}
|
||||
}
|
||||
|
||||
$( 'tr', $this_table ).removeClass( 'last_selected' );
|
||||
$this_row.addClass( 'last_selected' );
|
||||
$( 'tr', $this_table ).removeClass( 'selected_now' );
|
||||
}
|
||||
}).on( 'blur', 'input', function() {
|
||||
hasFocus = false;
|
||||
});
|
||||
|
||||
// Additional cost and Attribute term tables
|
||||
$( '.woocommerce_page_wc-settings .shippingrows tbody tr:even, table.attributes-table tbody tr:nth-child(odd)' ).addClass( 'alternate' );
|
||||
|
||||
// Show order items on orders page
|
||||
$( document.body ).on( 'click', '.show_order_items', function() {
|
||||
$( this ).closest( 'td' ).find( 'table' ).toggle();
|
||||
return false;
|
||||
});
|
||||
|
||||
// Select availability
|
||||
$( 'select.availability' ).change( function() {
|
||||
if ( $( this ).val() === 'all' ) {
|
||||
$( this ).closest( 'tr' ).next( 'tr' ).hide();
|
||||
} else {
|
||||
$( 'tr', $this_table ).removeClass( 'last_selected' );
|
||||
if ( controlled && $( this ).closest( 'tr' ).is( '.current' ) ) {
|
||||
$this_row.removeClass( 'current' );
|
||||
$( this ).closest( 'tr' ).next( 'tr' ).show();
|
||||
}
|
||||
}).change();
|
||||
|
||||
// Hidden options
|
||||
$( '.hide_options_if_checked' ).each( function() {
|
||||
$( this ).find( 'input:eq(0)' ).change( function() {
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).hide();
|
||||
} else {
|
||||
$this_row.addClass( 'current' ).addClass( 'last_selected' );
|
||||
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).show();
|
||||
}
|
||||
}
|
||||
}).change();
|
||||
});
|
||||
|
||||
$( 'tr', $this_table ).removeClass( 'selected_now' );
|
||||
}
|
||||
}).on( 'blur', 'input', function() {
|
||||
hasFocus = false;
|
||||
});
|
||||
$( '.show_options_if_checked' ).each( function() {
|
||||
$( this ).find( 'input:eq(0)' ).change( function() {
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).show();
|
||||
} else {
|
||||
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).hide();
|
||||
}
|
||||
}).change();
|
||||
});
|
||||
|
||||
// Additional cost and Attribute term tables
|
||||
$( '.woocommerce_page_wc-settings .shippingrows tbody tr:even, table.attributes-table tbody tr:nth-child(odd)' ).addClass( 'alternate' );
|
||||
|
||||
// Show order items on orders page
|
||||
$( document.body ).on( 'click', '.show_order_items', function() {
|
||||
$( this ).closest( 'td' ).find( 'table' ).toggle();
|
||||
return false;
|
||||
});
|
||||
|
||||
// Select availability
|
||||
$( 'select.availability' ).change( function() {
|
||||
if ( $( this ).val() === 'all' ) {
|
||||
$( this ).closest( 'tr' ).next( 'tr' ).hide();
|
||||
} else {
|
||||
$( this ).closest( 'tr' ).next( 'tr' ).show();
|
||||
}
|
||||
}).change();
|
||||
|
||||
// Hidden options
|
||||
$( '.hide_options_if_checked' ).each( function() {
|
||||
$( this ).find( 'input:eq(0)' ).change( function() {
|
||||
// Reviews.
|
||||
$( 'input#woocommerce_enable_reviews' ).change(function() {
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).hide();
|
||||
$( '#woocommerce_enable_review_rating' ).closest( 'tr' ).show();
|
||||
} else {
|
||||
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).show();
|
||||
$( '#woocommerce_enable_review_rating' ).closest( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
});
|
||||
|
||||
$( '.show_options_if_checked' ).each( function() {
|
||||
$( this ).find( 'input:eq(0)' ).change( function() {
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).show();
|
||||
} else {
|
||||
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).hide();
|
||||
}
|
||||
}).change();
|
||||
});
|
||||
// Attribute term table
|
||||
$( 'table.attributes-table tbody tr:nth-child(odd)' ).addClass( 'alternate' );
|
||||
|
||||
// Reviews.
|
||||
$( 'input#woocommerce_enable_reviews' ).change(function() {
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
$( '#woocommerce_enable_review_rating' ).closest( 'tr' ).show();
|
||||
} else {
|
||||
$( '#woocommerce_enable_review_rating' ).closest( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
// Toggle gateway on/off.
|
||||
$( '.wc_gateways' ).on( 'click', '.wc-payment-gateway-method-toggle-enabled', function() {
|
||||
var $link = $( this ),
|
||||
$row = $link.closest( 'tr' ),
|
||||
$toggle = $link.find( '.woocommerce-input-toggle' );
|
||||
|
||||
// Attribute term table
|
||||
$( 'table.attributes-table tbody tr:nth-child(odd)' ).addClass( 'alternate' );
|
||||
var data = {
|
||||
action: 'woocommerce_toggle_gateway_enabled',
|
||||
security: woocommerce_admin.nonces.gateway_toggle,
|
||||
gateway_id: $row.data( 'gateway_id' )
|
||||
};
|
||||
|
||||
$toggle.addClass( 'woocommerce-input-toggle--loading' );
|
||||
|
||||
// Toggle gateway on/off.
|
||||
$( '.wc_gateways' ).on( 'click', '.wc-payment-gateway-method-toggle-enabled', function() {
|
||||
var $link = $( this ),
|
||||
$row = $link.closest( 'tr' ),
|
||||
$toggle = $link.find( '.woocommerce-input-toggle' );
|
||||
|
||||
var data = {
|
||||
action: 'woocommerce_toggle_gateway_enabled',
|
||||
security: woocommerce_admin.nonces.gateway_toggle,
|
||||
gateway_id: $row.data( 'gateway_id' )
|
||||
};
|
||||
|
||||
$toggle.addClass( 'woocommerce-input-toggle--loading' );
|
||||
|
||||
$.ajax( {
|
||||
url: woocommerce_admin.ajax_url,
|
||||
data: data,
|
||||
dataType : 'json',
|
||||
type : 'POST',
|
||||
success: function( response ) {
|
||||
if ( true === response.data ) {
|
||||
$toggle.removeClass( 'woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled' );
|
||||
$toggle.addClass( 'woocommerce-input-toggle--enabled' );
|
||||
$toggle.removeClass( 'woocommerce-input-toggle--loading' );
|
||||
} else if ( false === response.data ) {
|
||||
$toggle.removeClass( 'woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled' );
|
||||
$toggle.addClass( 'woocommerce-input-toggle--disabled' );
|
||||
$toggle.removeClass( 'woocommerce-input-toggle--loading' );
|
||||
} else if ( 'needs_setup' === response.data ) {
|
||||
window.location.href = $link.attr( 'href' );
|
||||
$.ajax( {
|
||||
url: woocommerce_admin.ajax_url,
|
||||
data: data,
|
||||
dataType : 'json',
|
||||
type : 'POST',
|
||||
success: function( response ) {
|
||||
if ( true === response.data ) {
|
||||
$toggle.removeClass( 'woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled' );
|
||||
$toggle.addClass( 'woocommerce-input-toggle--enabled' );
|
||||
$toggle.removeClass( 'woocommerce-input-toggle--loading' );
|
||||
} else if ( false === response.data ) {
|
||||
$toggle.removeClass( 'woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled' );
|
||||
$toggle.addClass( 'woocommerce-input-toggle--disabled' );
|
||||
$toggle.removeClass( 'woocommerce-input-toggle--loading' );
|
||||
} else if ( 'needs_setup' === response.data ) {
|
||||
window.location.href = $link.attr( 'href' );
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
return false;
|
||||
return false;
|
||||
});
|
||||
});
|
||||
});
|
||||
})( jQuery, woocommerce_admin );
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* jQuery FlexSlider v2.7.0
|
||||
* jQuery FlexSlider v2.7.1
|
||||
* Copyright 2012 WooThemes
|
||||
* Contributing Author: Tyler Smith
|
||||
*/
|
||||
|
@ -15,8 +15,8 @@
|
|||
// making variables public
|
||||
|
||||
//if rtl value was not passed and html is in rtl..enable it by default.
|
||||
if(typeof options.rtl=='undefined' && $('html').attr('dir')=='rtl'){
|
||||
options.rtl=true;
|
||||
if(typeof options.rtl=='undefined' && $('html').attr('dir')=='rtl'){
|
||||
options.rtl=true;
|
||||
}
|
||||
slider.vars = $.extend({}, $.flexslider.defaults, options);
|
||||
|
||||
|
@ -75,6 +75,7 @@
|
|||
}
|
||||
return false;
|
||||
}());
|
||||
slider.isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||
slider.ensureAnimationEnd = '';
|
||||
// CONTROLSCONTAINER:
|
||||
if (slider.vars.controlsContainer !== "") slider.controlsContainer = $(slider.vars.controlsContainer).length > 0 && $(slider.vars.controlsContainer);
|
||||
|
@ -176,14 +177,14 @@
|
|||
e.preventDefault();
|
||||
var $slide = $(this),
|
||||
target = $slide.index();
|
||||
var posFromX;
|
||||
var posFromX;
|
||||
if(slider.vars.rtl){
|
||||
posFromX = -1*($slide.offset().right - $(slider).scrollLeft()); // Find position of slide relative to right of slider container
|
||||
}
|
||||
else
|
||||
{
|
||||
posFromX = $slide.offset().left - $(slider).scrollLeft(); // Find position of slide relative to left of slider container
|
||||
}
|
||||
posFromX = -1*($slide.offset().right - $(slider).scrollLeft()); // Find position of slide relative to right of slider container
|
||||
}
|
||||
else
|
||||
{
|
||||
posFromX = $slide.offset().left - $(slider).scrollLeft(); // Find position of slide relative to left of slider container
|
||||
}
|
||||
if( posFromX <= 0 && $slide.hasClass( namespace + 'active-slide' ) ) {
|
||||
slider.flexAnimate(slider.getTarget("prev"), true);
|
||||
} else if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass(namespace + "active-slide")) {
|
||||
|
@ -894,7 +895,7 @@
|
|||
}());
|
||||
|
||||
if (slider.transitions) {
|
||||
target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + ((slider.vars.rtl?-1:1)*parseInt(target)+'px') + ",0,0)";
|
||||
target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + (parseInt(target)+'px') + ",0,0)";
|
||||
dur = (dur !== undefined) ? (dur/1000) + "s" : "0s";
|
||||
slider.container.css("-" + slider.pfx + "-transition-duration", dur);
|
||||
slider.container.css("transition-duration", dur);
|
||||
|
@ -950,7 +951,7 @@
|
|||
setTimeout(function(){
|
||||
slider.doMath();
|
||||
if(slider.vars.rtl){
|
||||
slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "left", "display": "block"});
|
||||
slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "right", "display": "block"});
|
||||
}
|
||||
else{
|
||||
slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "left", "display": "block"});
|
||||
|
@ -996,6 +997,7 @@
|
|||
maxItems = slider.vars.maxItems;
|
||||
|
||||
slider.w = (slider.viewport===undefined) ? slider.width() : slider.viewport.width();
|
||||
if (slider.isFirefox) { slider.w = slider.width(); }
|
||||
slider.h = slide.height();
|
||||
slider.boxPadding = slide.outerWidth() - slide.width();
|
||||
|
||||
|
@ -1139,7 +1141,7 @@
|
|||
// Usability features
|
||||
pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
|
||||
pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
|
||||
pauseInvisible: true, //{NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage.
|
||||
pauseInvisible: true, //{NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage.
|
||||
useCSS: true, //{NEW} Boolean: Slider will use CSS3 transitions if available
|
||||
touch: true, //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
|
||||
video: false, //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
|
||||
|
@ -1173,6 +1175,9 @@
|
|||
move: 0, //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
|
||||
allowOneSlide: true, //{NEW} Boolean: Whether or not to allow a slider comprised of a single slide
|
||||
|
||||
// Browser Specific
|
||||
isFirefox: false, // {NEW} Boolean: Set to true when Firefox is the browser used.
|
||||
|
||||
// Callback API
|
||||
start: function(){}, //Callback: function(slider) - Fires when the slider loads the first slide
|
||||
before: function(){}, //Callback: function(slider) - Fires asynchronously with each slider animation
|
||||
|
@ -1181,7 +1186,7 @@
|
|||
added: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is added
|
||||
removed: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is removed
|
||||
init: function() {}, //{NEW} Callback: function(slider) - Fires after the slider is initially setup
|
||||
rtl: false //{NEW} Boolean: Whether or not to enable RTL mode
|
||||
rtl: false //{NEW} Boolean: Whether or not to enable RTL mode
|
||||
};
|
||||
|
||||
//FlexSlider: Plugin Function
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -538,7 +538,7 @@
|
|||
$product = $form.closest( '.product' ),
|
||||
$product_gallery = $product.find( '.images' ),
|
||||
reset_slide_position = false,
|
||||
new_image_id = ( variation && variation.image_id ) ? variation.image_id : '';
|
||||
new_image_id = ( variation && variation.image_id ) ? variation.image_id : '';
|
||||
|
||||
if ( $form.attr( 'current-image' ) !== new_image_id ) {
|
||||
reset_slide_position = true;
|
||||
|
@ -579,23 +579,27 @@
|
|||
if ( slideToImage.length > 0 ) {
|
||||
slideToImage.trigger( 'click' );
|
||||
$form.attr( 'current-image', variation.image_id );
|
||||
window.setTimeout( function() {
|
||||
$( window ).trigger( 'resize' );
|
||||
$product_gallery.trigger( 'woocommerce_gallery_init_zoom' );
|
||||
}, 20 );
|
||||
return;
|
||||
} else {
|
||||
$product_img.wc_set_variation_attr( 'src', variation.image.src );
|
||||
$product_img.wc_set_variation_attr( 'height', variation.image.src_h );
|
||||
$product_img.wc_set_variation_attr( 'width', variation.image.src_w );
|
||||
$product_img.wc_set_variation_attr( 'srcset', variation.image.srcset );
|
||||
$product_img.wc_set_variation_attr( 'sizes', variation.image.sizes );
|
||||
$product_img.wc_set_variation_attr( 'title', variation.image.title );
|
||||
$product_img.wc_set_variation_attr( 'alt', variation.image.alt );
|
||||
$product_img.wc_set_variation_attr( 'data-src', variation.image.full_src );
|
||||
$product_img.wc_set_variation_attr( 'data-large_image', variation.image.full_src );
|
||||
$product_img.wc_set_variation_attr( 'data-large_image_width', variation.image.full_src_w );
|
||||
$product_img.wc_set_variation_attr( 'data-large_image_height', variation.image.full_src_h );
|
||||
$product_img_wrap.wc_set_variation_attr( 'data-thumb', variation.image.src );
|
||||
$gallery_img.wc_set_variation_attr( 'src', variation.image.gallery_thumbnail_src );
|
||||
$product_link.wc_set_variation_attr( 'href', variation.image.full_src );
|
||||
}
|
||||
|
||||
$product_img.wc_set_variation_attr( 'src', variation.image.src );
|
||||
$product_img.wc_set_variation_attr( 'height', variation.image.src_h );
|
||||
$product_img.wc_set_variation_attr( 'width', variation.image.src_w );
|
||||
$product_img.wc_set_variation_attr( 'srcset', variation.image.srcset );
|
||||
$product_img.wc_set_variation_attr( 'sizes', variation.image.sizes );
|
||||
$product_img.wc_set_variation_attr( 'title', variation.image.title );
|
||||
$product_img.wc_set_variation_attr( 'alt', variation.image.alt );
|
||||
$product_img.wc_set_variation_attr( 'data-src', variation.image.full_src );
|
||||
$product_img.wc_set_variation_attr( 'data-large_image', variation.image.full_src );
|
||||
$product_img.wc_set_variation_attr( 'data-large_image_width', variation.image.full_src_w );
|
||||
$product_img.wc_set_variation_attr( 'data-large_image_height', variation.image.full_src_h );
|
||||
$product_img_wrap.wc_set_variation_attr( 'data-thumb', variation.image.src );
|
||||
$gallery_img.wc_set_variation_attr( 'src', variation.image.gallery_thumbnail_src );
|
||||
$product_link.wc_set_variation_attr( 'href', variation.image.full_src );
|
||||
} else {
|
||||
$form.wc_variations_image_reset();
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
jQuery(function(e){function a(e,a){a?(e.find("label .optional").remove(),e.addClass("validate-required"),0===e.find("label .required").length&&e.find("label").append(' <abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>')):(e.find("label .required").remove(),e.removeClass("validate-required"),0===e.find("label .required").length&&e.find("label").append(' <span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>"))}if("undefined"==typeof wc_address_i18n_params)return!1;var i=wc_address_i18n_params.locale.replace(/"/g,'"'),d=e.parseJSON(i);e(document.body).bind("country_to_state_changing",function(i,t,r){var l,n=r;l="undefined"!=typeof d[t]?d[t]:d["default"];var o=n.find("#billing_postcode_field, #shipping_postcode_field"),s=n.find("#billing_city_field, #shipping_city_field"),p=n.find("#billing_state_field, #shipping_state_field");o.attr("data-o_class")||(o.attr("data-o_class",o.attr("class")),s.attr("data-o_class",s.attr("class")),p.attr("data-o_class",p.attr("class")));var f=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(f,function(i,t){var r=n.find(t),o=e.extend(!0,{},d["default"][i],l[i]);"undefined"!=typeof o.label&&r.find("label").html(o.label),"undefined"!=typeof o.placeholder&&(r.find("input").attr("placeholder",o.placeholder),r.find(".select2-selection__placeholder").text(o.placeholder)),"undefined"!=typeof o.placeholder||"undefined"==typeof o.label||r.find("label").length||(r.find("input").attr("placeholder",o.label),r.find(".select2-selection__placeholder").text(o.label)),"undefined"!=typeof o.required?a(r,o.required):a(r,!1),"undefined"!=typeof o.priority&&r.data("priority",o.priority),"state"!==i&&("undefined"!=typeof o.hidden&&!0===o.hidden?r.hide().find("input").val(""):r.show())}),e(".woocommerce-billing-fields__field-wrapper, .woocommerce-shipping-fields__field-wrapper, .woocommerce-address-fields__field-wrapper, .woocommerce-additional-fields__field-wrapper .woocommerce-account-fields").each(function(a,i){var d=e(i).find(".form-row"),t=d.first().parent(),r=0;d.each(function(){e(this).data("priority")||e(this).data("priority",r+1),r=e(this).data("priority")}),d.sort(function(a,i){var d=e(a).data("priority"),t=e(i).data("priority");return d>t?1:d<t?-1:0}),d.detach().appendTo(t)})})});
|
||||
jQuery(function(e){function a(e,a){a?(e.find("label .optional").remove(),e.addClass("validate-required"),0===e.find("label .required").length&&e.find("label").append(' <abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>')):(e.find("label .required").remove(),e.removeClass("validate-required"),0===e.find("label .optional").length&&e.find("label").append(' <span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>"))}if("undefined"==typeof wc_address_i18n_params)return!1;var i=wc_address_i18n_params.locale.replace(/"/g,'"'),d=e.parseJSON(i);e(document.body).bind("country_to_state_changing",function(i,t,l){var r,n=l;r="undefined"!=typeof d[t]?d[t]:d["default"];var o=n.find("#billing_postcode_field, #shipping_postcode_field"),s=n.find("#billing_city_field, #shipping_city_field"),p=n.find("#billing_state_field, #shipping_state_field");o.attr("data-o_class")||(o.attr("data-o_class",o.attr("class")),s.attr("data-o_class",s.attr("class")),p.attr("data-o_class",p.attr("class")));var f=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(f,function(i,t){var l=n.find(t),o=e.extend(!0,{},d["default"][i],r[i]);"undefined"!=typeof o.label&&l.find("label").html(o.label),"undefined"!=typeof o.placeholder&&(l.find("input").attr("placeholder",o.placeholder),l.find(".select2-selection__placeholder").text(o.placeholder)),"undefined"!=typeof o.placeholder||"undefined"==typeof o.label||l.find("label").length||(l.find("input").attr("placeholder",o.label),l.find(".select2-selection__placeholder").text(o.label)),"undefined"!=typeof o.required?a(l,o.required):a(l,!1),"undefined"!=typeof o.priority&&l.data("priority",o.priority),"state"!==i&&("undefined"!=typeof o.hidden&&!0===o.hidden?l.hide().find("input").val(""):l.show())}),e(".woocommerce-billing-fields__field-wrapper, .woocommerce-shipping-fields__field-wrapper, .woocommerce-address-fields__field-wrapper, .woocommerce-additional-fields__field-wrapper .woocommerce-account-fields").each(function(a,i){var d=e(i).find(".form-row"),t=d.first().parent(),l=0;d.each(function(){e(this).data("priority")||e(this).data("priority",l+1),l=e(this).data("priority")}),d.sort(function(a,i){var d=e(a).data("priority"),t=e(i).data("priority");return d>t?1:d<t?-1:0}),d.detach().appendTo(t)})})});
|
|
@ -93,7 +93,7 @@ jQuery( function( $ ) {
|
|||
|
||||
// Display errors
|
||||
if ( $notices.length > 0 ) {
|
||||
show_notice( $notices, $( '.cart-empty' ).closest( '.woocommerce' ) );
|
||||
show_notice( $notices );
|
||||
}
|
||||
} else {
|
||||
// If the checkout is also displayed on this page, trigger update event.
|
||||
|
@ -125,15 +125,15 @@ jQuery( function( $ ) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Clear previous notices and shows new one above form.
|
||||
* Shows new notices on the page.
|
||||
*
|
||||
* @param {Object} The Notice HTML Element in string or object form.
|
||||
*/
|
||||
var show_notice = function( html_element, $target ) {
|
||||
if ( ! $target ) {
|
||||
$target = $( '.woocommerce-cart-form' );
|
||||
$target = $( '.woocommerce-notices-wrapper:first' ) || $( '.cart-empty' ).closest( '.woocommerce' ) || $( '.woocommerce-cart-form' );
|
||||
}
|
||||
$target.before( html_element );
|
||||
$target.prepend( html_element );
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(a){var o=window.location.toString(),t=function(){wc_geolocation_params.hash&&a('a[href^="'+wc_geolocation_params.home_url+'"]:not(a[href*="v="]), a[href^="/"]:not(a[href*="v="])').each(function(){var o=a(this),t=o.attr("href"),e=t.split("#");t=(t=e[0]).indexOf("?")>0?t+"&v="+wc_geolocation_params.hash:t+"?v="+wc_geolocation_params.hash,"undefined"!=typeof e[1]&&null!==e[1]&&(t=t+"#"+e[1]),o.attr("href",t)})},e=function(a){o=o.indexOf("?v=")>0||o.indexOf("&v=")>0?o.replace(/v=[^&]+/,"v="+a):o.indexOf("?")>0?o+"&v="+a:o+"?v="+a,window.location=o},n={url:wc_geolocation_params.wc_ajax_url.toString().replace("%%endpoint%%","get_customer_location"),type:"GET",success:function(a){a.success&&a.data.hash&&a.data.hash!==wc_geolocation_params.hash&&e(a.data.hash)}};"1"===wc_geolocation_params.is_available&&(a.ajax(n),a("form").each(function(){var o=a(this),t=o.attr("method");if(t&&"get"===t.toLowerCase())o.append('<input type="hidden" name="v" value="'+wc_geolocation_params.hash+'" />');else{var e=o.attr("action");e&&(e.indexOf("?")>0?o.attr("action",e+"&v="+wc_geolocation_params.hash):o.attr("action",e+"?v="+wc_geolocation_params.hash))}}),t()),a(document.body).on("added_to_cart",function(){t()})});
|
||||
jQuery(function(a){var o=window.location.toString(),t=function(){wc_geolocation_params.hash&&a('a[href^="'+wc_geolocation_params.home_url+'"]:not(a[href*="v="]), a[href^="/"]:not(a[href*="v="])').each(function(){var o=a(this),t=o.attr("href"),n=t.split("#");t=(t=n[0]).indexOf("?")>0?t+"&v="+wc_geolocation_params.hash:t+"?v="+wc_geolocation_params.hash,"undefined"!=typeof n[1]&&null!==n[1]&&(t=t+"#"+n[1]),o.attr("href",t)})},n=function(a){o=o.indexOf("?v=")>0||o.indexOf("&v=")>0?o.replace(/v=[^&]+/,"v="+a):o.indexOf("?")>0?o+"&v="+a:o+"?v="+a,window.location=o},e={url:wc_geolocation_params.wc_ajax_url.toString().replace("%%endpoint%%","get_customer_location"),type:"GET",success:function(a){a.success&&a.data.hash&&a.data.hash!==wc_geolocation_params.hash&&n(a.data.hash)}};"1"===wc_geolocation_params.is_available&&(a.ajax(e),a("form").each(function(){var o=a(this),t=o.attr("method"),n=o.find('input[name="v"]').length>0;if(t&&"get"===t.toLowerCase()&&!n)o.append('<input type="hidden" name="v" value="'+wc_geolocation_params.hash+'" />');else{var e=o.attr("action");e&&(e.indexOf("?")>0?o.attr("action",e+"&v="+wc_geolocation_params.hash):o.attr("action",e+"?v="+wc_geolocation_params.hash))}}),t()),a(document.body).on("added_to_cart",function(){t()})});
|
|
@ -1 +1 @@
|
|||
!function(s){"use strict";var r={init:function(){s(document.body).on("keyup change","form.register #reg_password, form.checkout #account_password, form.edit-account #password_1, form.lost_reset_password #password_1",this.strengthMeter),s("form.checkout #createaccount").change()},strengthMeter:function(){var e=s("form.register, form.checkout, form.edit-account, form.lost_reset_password"),t=s('button[type="submit"]',e),o=s("#reg_password, #account_password, #password_1",e),a=1,d=o.val();r.includeMeter(e,o),a=r.checkPasswordStrength(e,o),d.length>0&&a<wc_password_strength_meter_params.min_password_strength&&!e.is("form.checkout")?t.attr("disabled","disabled").addClass("disabled"):t.removeAttr("disabled","disabled").removeClass("disabled")},includeMeter:function(r,e){var t=r.find(".woocommerce-password-strength");""===e.val()?(t.hide(),s(document.body).trigger("wc-password-strength-hide")):0===t.length?(e.after('<div class="woocommerce-password-strength" aria-live="polite"></div>'),s(document.body).trigger("wc-password-strength-added")):(t.show(),s(document.body).trigger("wc-password-strength-show"))},checkPasswordStrength:function(s,r){var e=s.find(".woocommerce-password-strength"),t=s.find(".woocommerce-password-hint"),o='<small class="woocommerce-password-hint">'+wc_password_strength_meter_params.i18n_password_hint+"</small>",a=wp.passwordStrength.meter(r.val(),wp.passwordStrength.userInputBlacklist()),d="";if(e.removeClass("short bad good strong"),t.remove(),e.is(":hidden"))return a;switch(a<wc_password_strength_meter_params.min_password_strength&&(d=" - "+wc_password_strength_meter_params.i18n_password_error),a){case 0:e.addClass("short").html(pwsL10n["short"]+d),e.after(o);break;case 1:case 2:e.addClass("bad").html(pwsL10n.bad+d),e.after(o);break;case 3:e.addClass("good").html(pwsL10n.good+d);break;case 4:e.addClass("strong").html(pwsL10n.strong+d);break;case 5:e.addClass("short").html(pwsL10n.mismatch)}return a}};r.init()}(jQuery);
|
||||
!function(s){"use strict";var r={init:function(){s(document.body).on("keyup change","form.register #reg_password, form.checkout #account_password, form.edit-account #password_1, form.lost_reset_password #password_1",this.strengthMeter),s("form.checkout #createaccount").change()},strengthMeter:function(){var e=s("form.register, form.checkout, form.edit-account, form.lost_reset_password"),t=s('button[type="submit"]',e),o=s("#reg_password, #account_password, #password_1",e),a=1,d=o.val();r.includeMeter(e,o),a=r.checkPasswordStrength(e,o),d.length>0&&a<wc_password_strength_meter_params.min_password_strength&&!e.is("form.checkout")&&-1!==a?t.attr("disabled","disabled").addClass("disabled"):t.removeAttr("disabled","disabled").removeClass("disabled")},includeMeter:function(r,e){var t=r.find(".woocommerce-password-strength");""===e.val()?(t.hide(),s(document.body).trigger("wc-password-strength-hide")):0===t.length?(e.after('<div class="woocommerce-password-strength" aria-live="polite"></div>'),s(document.body).trigger("wc-password-strength-added")):(t.show(),s(document.body).trigger("wc-password-strength-show"))},checkPasswordStrength:function(s,r){var e=s.find(".woocommerce-password-strength"),t=s.find(".woocommerce-password-hint"),o='<small class="woocommerce-password-hint">'+wc_password_strength_meter_params.i18n_password_hint+"</small>",a=wp.passwordStrength.meter(r.val(),wp.passwordStrength.userInputBlacklist()),d="";if(e.removeClass("short bad good strong"),t.remove(),e.is(":hidden"))return a;switch(a<wc_password_strength_meter_params.min_password_strength&&(d=" - "+wc_password_strength_meter_params.i18n_password_error),a){case 0:e.addClass("short").html(pwsL10n["short"]+d),e.after(o);break;case 1:case 2:e.addClass("bad").html(pwsL10n.bad+d),e.after(o);break;case 3:e.addClass("good").html(pwsL10n.good+d);break;case 4:e.addClass("strong").html(pwsL10n.strong+d);break;case 5:e.addClass("short").html(pwsL10n.mismatch)}return a}};r.init()}(jQuery);
|
File diff suppressed because it is too large
Load Diff
|
@ -1182,6 +1182,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
$item->save();
|
||||
$this->add_item( $item );
|
||||
wc_do_deprecated_action( 'woocommerce_order_add_product', array( $this->get_id(), $item->get_id(), $product, $qty, $args ), '3.0', 'woocommerce_new_order_item action instead' );
|
||||
delete_transient( 'wc_order_' . $this->get_id() . '_needs_processing' );
|
||||
return $item->get_id();
|
||||
}
|
||||
|
||||
|
|
|
@ -54,9 +54,11 @@ abstract class WC_Abstract_Privacy {
|
|||
protected $erase_priority;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* WC_Abstract_Privacy Constructor.
|
||||
*
|
||||
* @param string $name Plugin identifier.
|
||||
* @param string $name Plugin identifier.
|
||||
* @param int $export_priority Export priority.
|
||||
* @param int $erase_priority Erase priority.
|
||||
*/
|
||||
public function __construct( $name = '', $export_priority = 5, $erase_priority = 10 ) {
|
||||
$this->name = $name;
|
||||
|
@ -127,9 +129,11 @@ abstract class WC_Abstract_Privacy {
|
|||
/**
|
||||
* Add exporter to list of exporters.
|
||||
*
|
||||
* @param string $id ID of the Exporter.
|
||||
* @param string $name Exporter name.
|
||||
* @param string $callback Exporter callback.
|
||||
* @param string $id ID of the Exporter.
|
||||
* @param string $name Exporter name.
|
||||
* @param string|array $callback Exporter callback.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function add_exporter( $id, $name, $callback ) {
|
||||
$this->exporters[ $id ] = array(
|
||||
|
@ -142,9 +146,11 @@ abstract class WC_Abstract_Privacy {
|
|||
/**
|
||||
* Add eraser to list of erasers.
|
||||
*
|
||||
* @param string $id ID of the Eraser.
|
||||
* @param string $name Exporter name.
|
||||
* @param string $callback Exporter callback.
|
||||
* @param string $id ID of the Eraser.
|
||||
* @param string $name Exporter name.
|
||||
* @param string|array $callback Exporter callback.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function add_eraser( $id, $name, $callback ) {
|
||||
$this->erasers[ $id ] = array(
|
||||
|
|
|
@ -360,7 +360,7 @@ if ( ! class_exists( 'WC_Admin_Dashboard', false ) ) :
|
|||
<script type="text/template" id="network-orders-row-template">
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<%- edit_url %>" class="order-view"><strong>#<%- id %> <%- customer %></strong></a>
|
||||
<a href="<%- edit_url %>" class="order-view"><strong>#<%- number %> <%- customer %></strong></a>
|
||||
<br>
|
||||
<em>
|
||||
<%- blog.blogname %>
|
||||
|
|
|
@ -132,11 +132,13 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
|
||||
do_action( 'woocommerce_settings_start' );
|
||||
|
||||
wp_enqueue_script( 'woocommerce_settings', WC()->plugin_url() . '/assets/js/admin/settings' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'iris', 'selectWoo' ), WC()->version, true );
|
||||
wp_enqueue_script( 'woocommerce_settings', WC()->plugin_url() . '/assets/js/admin/settings' . $suffix . '.js', array( 'jquery', 'wp-util', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'iris', 'selectWoo' ), WC()->version, true );
|
||||
|
||||
wp_localize_script(
|
||||
'woocommerce_settings', 'woocommerce_settings_params', array(
|
||||
'i18n_nav_warning' => __( 'The changes you made will be lost if you navigate away from this page.', 'woocommerce' ),
|
||||
'i18n_moved_up' => __( 'Item moved up', 'woocommerce' ),
|
||||
'i18n_moved_down' => __( 'Item moved down', 'woocommerce' ),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -249,7 +251,9 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
echo '<h2>' . esc_html( $value['title'] ) . '</h2>';
|
||||
}
|
||||
if ( ! empty( $value['desc'] ) ) {
|
||||
echo '<div id="' . esc_attr( sanitize_title( $value['id'] ) ) . '-description">';
|
||||
echo wp_kses_post( wpautop( wptexturize( $value['desc'] ) ) );
|
||||
echo '</div>';
|
||||
}
|
||||
echo '<table class="form-table">' . "\n\n";
|
||||
if ( ! empty( $value['id'] ) ) {
|
||||
|
|
|
@ -623,7 +623,7 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
|
|||
* @return string
|
||||
*/
|
||||
public function handle_bulk_actions( $redirect_to, $action, $ids ) {
|
||||
$ids = array_map( 'absint', $ids );
|
||||
$ids = apply_filters( 'woocommerce_bulk_action_ids', array_reverse( array_map( 'absint', $ids ) ), $action, 'order' );
|
||||
$changed = 0;
|
||||
|
||||
if ( 'remove_personal_data' === $action ) {
|
||||
|
|
|
@ -332,7 +332,9 @@ class WC_Meta_Box_Order_Data {
|
|||
|
||||
$field_name = 'billing_' . $key;
|
||||
|
||||
if ( is_callable( array( $order, 'get_' . $field_name ) ) ) {
|
||||
if ( isset( $field['value'] ) ) {
|
||||
$field_value = $field['value'];
|
||||
} elseif ( is_callable( array( $order, 'get_' . $field_name ) ) ) {
|
||||
$field_value = $order->{"get_$field_name"}( 'edit' );
|
||||
} else {
|
||||
$field_value = $order->get_meta( '_' . $field_name );
|
||||
|
@ -365,10 +367,12 @@ class WC_Meta_Box_Order_Data {
|
|||
|
||||
$field_name = 'billing_' . $key;
|
||||
|
||||
if ( is_callable( array( $order, 'get_' . $field_name ) ) ) {
|
||||
$field['value'] = $order->{"get_$field_name"}( 'edit' );
|
||||
} else {
|
||||
$field['value'] = $order->get_meta( '_' . $field_name );
|
||||
if ( ! isset( $field['value'] ) ) {
|
||||
if ( is_callable( array( $order, 'get_' . $field_name ) ) ) {
|
||||
$field['value'] = $order->{"get_$field_name"}( 'edit' );
|
||||
} else {
|
||||
$field['value'] = $order->get_meta( '_' . $field_name );
|
||||
}
|
||||
}
|
||||
|
||||
switch ( $field['type'] ) {
|
||||
|
|
|
@ -53,7 +53,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
|
|||
'woocommerce_payment_gateways_settings', array(
|
||||
array(
|
||||
'title' => __( 'Payment methods', 'woocommerce' ),
|
||||
'desc' => __( 'Installed payment methods are listed below. Drag and drop gateways to control their display order on the frontend.', 'woocommerce' ),
|
||||
'desc' => __( 'Installed payment methods are listed below and can be sorted to control their display order on the frontend.', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'id' => 'payment_gateways_options',
|
||||
),
|
||||
|
@ -107,7 +107,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
|
|||
?>
|
||||
<tr valign="top">
|
||||
<td class="wc_payment_gateways_wrapper" colspan="2">
|
||||
<table class="wc_gateways widefat" cellspacing="0">
|
||||
<table class="wc_gateways widefat" cellspacing="0" aria-describedby="payment_gateways_options-description">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php
|
||||
|
@ -145,17 +145,26 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
|
|||
$width = '1%';
|
||||
}
|
||||
|
||||
$method_title = $gateway->get_method_title() ? $gateway->get_method_title() : $gateway->get_title();
|
||||
$custom_title = $gateway->get_title();
|
||||
|
||||
echo '<td class="' . esc_attr( $key ) . '" width="' . esc_attr( $width ) . '">';
|
||||
|
||||
switch ( $key ) {
|
||||
case 'sort':
|
||||
echo '<input type="hidden" name="gateway_order[]" value="' . esc_attr( $gateway->id ) . '" />';
|
||||
?>
|
||||
<div class="wc-item-reorder-nav">
|
||||
<button type="button" class="wc-move-up" tabindex="0" aria-hidden="false" aria-label="<?php /* Translators: %s Payment gateway name. */ echo esc_attr( sprintf( __( 'Move the "%s" payment method up', 'woocommerce' ), $method_title ) ); ?>"><?php esc_html_e( 'Move up', 'woocommerce' ); ?></button>
|
||||
<button type="button" class="wc-move-down" tabindex="0" aria-hidden="false" aria-label="<?php /* Translators: %s Payment gateway name. */ echo esc_attr( sprintf( __( 'Move the "%s" payment method down', 'woocommerce' ), $method_title ) ); ?>"><?php esc_html_e( 'Move down', 'woocommerce' ); ?></button>
|
||||
<input type="hidden" name="gateway_order[]" value="<?php echo esc_attr( $gateway->id ); ?>" />
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case 'name':
|
||||
$method_title = $gateway->get_title() ? $gateway->get_title() : __( '(no title)', 'woocommerce' );
|
||||
echo '<a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . strtolower( $gateway->id ) ) ) . '" class="wc-payment-gateway-method-title">' . wp_kses_post( $gateway->get_method_title() ) . '</a>';
|
||||
if ( $method_title !== $gateway->get_method_title() ) {
|
||||
echo '<span class="wc-payment-gateway-method-name"> – ' . esc_html( $method_title ) . '</span>';
|
||||
echo '<a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . strtolower( $gateway->id ) ) ) . '" class="wc-payment-gateway-method-title">' . wp_kses_post( $method_title ) . '</a>';
|
||||
|
||||
if ( $method_title !== $custom_title ) {
|
||||
echo '<span class="wc-payment-gateway-method-name"> – ' . wp_kses_post( $custom_title ) . '</span>';
|
||||
}
|
||||
break;
|
||||
case 'description':
|
||||
|
@ -163,17 +172,21 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
|
|||
break;
|
||||
case 'action':
|
||||
if ( wc_string_to_bool( $gateway->enabled ) ) {
|
||||
echo '<a class="button alignright" href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . strtolower( $gateway->id ) ) ) . '">' . esc_html__( 'Manage', 'woocommerce' ) . '</a>';
|
||||
/* Translators: %s Payment gateway name. */
|
||||
echo '<a class="button alignright" aria-label="' . esc_attr( sprintf( __( 'Manage the "%s" payment method', 'woocommerce' ), $method_title ) ) . '" href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . strtolower( $gateway->id ) ) ) . '">' . esc_html__( 'Manage', 'woocommerce' ) . '</a>';
|
||||
} else {
|
||||
echo '<a class="button alignright" href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . strtolower( $gateway->id ) ) ) . '">' . esc_html__( 'Set up', 'woocommerce' ) . '</a>';
|
||||
/* Translators: %s Payment gateway name. */
|
||||
echo '<a class="button alignright" aria-label="' . esc_attr( sprintf( __( 'Set up the "%s" payment method', 'woocommerce' ), $method_title ) ) . '" href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . strtolower( $gateway->id ) ) ) . '">' . esc_html__( 'Set up', 'woocommerce' ) . '</a>';
|
||||
}
|
||||
break;
|
||||
case 'status':
|
||||
echo '<a class="wc-payment-gateway-method-toggle-enabled" href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . strtolower( $gateway->id ) ) ) . '">';
|
||||
if ( wc_string_to_bool( $gateway->enabled ) ) {
|
||||
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--enabled">' . esc_attr__( 'Yes', 'woocommerce' ) . '</span>';
|
||||
/* Translators: %s Payment gateway name. */
|
||||
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--enabled" aria-label="' . esc_attr( sprintf( __( 'The "%s" payment method is currently enabled', 'woocommerce' ), $method_title ) ) . '">' . esc_attr__( 'Yes', 'woocommerce' ) . '</span>';
|
||||
} else {
|
||||
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--disabled">' . esc_attr__( 'No', 'woocommerce' ) . '</span>';
|
||||
/* Translators: %s Payment gateway name. */
|
||||
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--disabled" aria-label="' . esc_attr( sprintf( __( 'The "%s" payment method is currently disabled', 'woocommerce' ), $method_title ) ) . '">' . esc_attr__( 'No', 'woocommerce' ) . '</span>';
|
||||
}
|
||||
echo '</a>';
|
||||
break;
|
||||
|
|
|
@ -85,8 +85,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
);
|
||||
|
||||
foreach ( $topics as $topic_slug => $topic_name ) :
|
||||
|
||||
$selected = $topic_slug === $topic_data['topic'] || $topic_slug === $topic_data['resource'] . '.' . $topic_data['event'];
|
||||
|
||||
?>
|
||||
<option value="<?php echo esc_attr( $topic_slug ); ?>" <?php selected( $topic_data['topic'], $topic_slug, true ); ?>><?php echo esc_html( $topic_name ); ?></option>
|
||||
<option value="<?php echo esc_attr( $topic_slug ); ?>" <?php selected( $selected, true, true ); ?>><?php echo esc_html( $topic_name ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
|
|
|
@ -1,16 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* Admin View: Notice - Update
|
||||
*
|
||||
* @package WooCommerce\Admin
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$update_url = wp_nonce_url(
|
||||
add_query_arg( 'do_update_woocommerce', 'true', admin_url( 'admin.php?page=wc-settings' ) ),
|
||||
'wc_db_update',
|
||||
'wc_db_update_nonce'
|
||||
);
|
||||
|
||||
?>
|
||||
<div id="message" class="updated woocommerce-message wc-connect">
|
||||
<p><strong><?php _e( 'WooCommerce data update', 'woocommerce' ); ?></strong> – <?php _e( 'We need to update your store database to the latest version.', 'woocommerce' ); ?></p>
|
||||
<p class="submit"><a href="<?php echo esc_url( add_query_arg( 'do_update_woocommerce', 'true', admin_url( 'admin.php?page=wc-settings' ) ) ); ?>" class="wc-update-now button-primary"><?php _e( 'Run the updater', 'woocommerce' ); ?></a></p>
|
||||
<p>
|
||||
<strong><?php esc_html_e( 'WooCommerce data update', 'woocommerce' ); ?></strong> – <?php esc_html_e( 'We need to update your store database to the latest version.', 'woocommerce' ); ?>
|
||||
</p>
|
||||
<p class="submit">
|
||||
<a href="<?php echo esc_url( $update_url ); ?>" class="wc-update-now button-primary">
|
||||
<?php esc_html_e( 'Run the updater', 'woocommerce' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery( '.wc-update-now' ).click( 'click', function() {
|
||||
|
|
|
@ -1,13 +1,26 @@
|
|||
<?php
|
||||
/**
|
||||
* Admin View: Notice - Updating
|
||||
*
|
||||
* @package WooCommerce\Admin
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$force_update_url = wp_nonce_url(
|
||||
add_query_arg( 'force_update_woocommerce', 'true', admin_url( 'admin.php?page=wc-settings' ) ),
|
||||
'wc_force_db_update',
|
||||
'wc_force_db_update_nonce'
|
||||
);
|
||||
|
||||
?>
|
||||
<div id="message" class="updated woocommerce-message wc-connect">
|
||||
<p><strong><?php _e( 'WooCommerce data update', 'woocommerce' ); ?></strong> – <?php _e( 'Your database is being updated in the background.', 'woocommerce' ); ?> <a href="<?php echo esc_url( add_query_arg( 'force_update_woocommerce', 'true', admin_url( 'admin.php?page=wc-settings' ) ) ); ?>"><?php _e( 'Taking a while? Click here to run it now.', 'woocommerce' ); ?></a></p>
|
||||
<p>
|
||||
<strong><?php esc_html_e( 'WooCommerce data update', 'woocommerce' ); ?></strong> – <?php esc_html_e( 'Your database is being updated in the background.', 'woocommerce' ); ?>
|
||||
<a href="<?php echo esc_url( $force_update_url ); ?>">
|
||||
<?php esc_html_e( 'Taking a while? Click here to run it now.', 'woocommerce' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -127,14 +127,20 @@ class WC_REST_Orders_Controller extends WC_REST_Legacy_Orders_Controller {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get object.
|
||||
* Get object. Return false if object is not of required type.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param int $id Object ID.
|
||||
* @return WC_Data
|
||||
* @return WC_Data|bool
|
||||
*/
|
||||
protected function get_object( $id ) {
|
||||
return wc_get_order( $id );
|
||||
$order = wc_get_order( $id );
|
||||
// In case id is a refund's id (or it's not an order at all), don't expose it via /orders/ path.
|
||||
if ( ! $order || 'shop_order_refund' === $order->get_type() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $order;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -345,11 +345,10 @@ class WC_AJAX {
|
|||
$woocommerce_checkout_payment = ob_get_clean();
|
||||
|
||||
// Get messages if reload checkout is not true
|
||||
$messages = '';
|
||||
if ( ! isset( WC()->session->reload_checkout ) ) {
|
||||
ob_start();
|
||||
wc_print_notices();
|
||||
$messages = ob_get_clean();
|
||||
$messages = wc_print_notices( true );
|
||||
} else {
|
||||
$messages = '';
|
||||
}
|
||||
|
||||
unset( WC()->session->refresh_totals, WC()->session->reload_checkout );
|
||||
|
|
|
@ -287,6 +287,7 @@ class WC_Auth {
|
|||
* Handle auth requests.
|
||||
*
|
||||
* @since 2.4.0
|
||||
* @throws Exception When auth_endpoint validation fails.
|
||||
*/
|
||||
public function handle_auth_requests() {
|
||||
global $wp;
|
||||
|
@ -295,7 +296,7 @@ class WC_Auth {
|
|||
$wp->query_vars['wc-auth-version'] = wc_clean( wp_unslash( $_GET['wc-auth-version'] ) ); // WPCS: input var ok, CSRF ok.
|
||||
}
|
||||
|
||||
if ( ! empty( $_GET['wc-auth-route'] ) ) {
|
||||
if ( ! empty( $_GET['wc-auth-route'] ) ) { // WPCS: input var ok, CSRF ok.
|
||||
$wp->query_vars['wc-auth-route'] = wc_clean( wp_unslash( $_GET['wc-auth-route'] ) ); // WPCS: input var ok, CSRF ok.
|
||||
}
|
||||
|
||||
|
|
|
@ -645,8 +645,9 @@ class WC_Checkout {
|
|||
*/
|
||||
protected function validate_posted_data( &$data, &$errors ) {
|
||||
foreach ( $this->get_checkout_fields() as $fieldset_key => $fieldset ) {
|
||||
$validate_fieldset = true;
|
||||
if ( $this->maybe_skip_fieldset( $fieldset_key, $data ) ) {
|
||||
continue;
|
||||
$validate_fieldset = false;
|
||||
}
|
||||
|
||||
foreach ( $fieldset as $key => $field ) {
|
||||
|
@ -672,11 +673,11 @@ class WC_Checkout {
|
|||
$country = isset( $data[ $fieldset_key . '_country' ] ) ? $data[ $fieldset_key . '_country' ] : WC()->customer->{"get_{$fieldset_key}_country"}();
|
||||
$data[ $key ] = wc_format_postcode( $data[ $key ], $country );
|
||||
|
||||
if ( '' !== $data[ $key ] && ! WC_Validation::is_postcode( $data[ $key ], $country ) ) {
|
||||
if ( $validate_fieldset && '' !== $data[ $key ] && ! WC_Validation::is_postcode( $data[ $key ], $country ) ) {
|
||||
switch ( $country ) {
|
||||
case 'IE':
|
||||
/* translators: %1$s: field name, %2$s finder.eircode.ie URL */
|
||||
$postcode_validation_notice = sprintf( __( '%1$s is not a valid. You can look up the correct Eircode <a target="_blank" href="%2$s">here</a>.', 'woocommerce' ), '<strong>' . esc_html( $field_label ) . '</strong>', 'https://finder.eircode.ie' );
|
||||
$postcode_validation_notice = sprintf( __( '%1$s is not valid. You can look up the correct Eircode <a target="_blank" href="%2$s">here</a>.', 'woocommerce' ), '<strong>' . esc_html( $field_label ) . '</strong>', 'https://finder.eircode.ie' );
|
||||
break;
|
||||
default:
|
||||
/* translators: %s: field name */
|
||||
|
@ -689,7 +690,7 @@ class WC_Checkout {
|
|||
if ( in_array( 'phone', $format, true ) ) {
|
||||
$data[ $key ] = wc_format_phone_number( $data[ $key ] );
|
||||
|
||||
if ( '' !== $data[ $key ] && ! WC_Validation::is_phone( $data[ $key ] ) ) {
|
||||
if ( $validate_fieldset && '' !== $data[ $key ] && ! WC_Validation::is_phone( $data[ $key ] ) ) {
|
||||
/* translators: %s: phone number */
|
||||
$errors->add( 'validation', sprintf( __( '%s is not a valid phone number.', 'woocommerce' ), '<strong>' . esc_html( $field_label ) . '</strong>' ) );
|
||||
}
|
||||
|
@ -698,7 +699,7 @@ class WC_Checkout {
|
|||
if ( in_array( 'email', $format, true ) && '' !== $data[ $key ] ) {
|
||||
$data[ $key ] = sanitize_email( $data[ $key ] );
|
||||
|
||||
if ( ! is_email( $data[ $key ] ) ) {
|
||||
if ( $validate_fieldset && ! is_email( $data[ $key ] ) ) {
|
||||
/* translators: %s: email address */
|
||||
$errors->add( 'validation', sprintf( __( '%s is not a valid email address.', 'woocommerce' ), '<strong>' . esc_html( $field_label ) . '</strong>' ) );
|
||||
continue;
|
||||
|
@ -718,14 +719,14 @@ class WC_Checkout {
|
|||
$data[ $key ] = $valid_state_values[ $data[ $key ] ];
|
||||
}
|
||||
|
||||
if ( ! in_array( $data[ $key ], $valid_state_values, true ) ) {
|
||||
if ( $validate_fieldset && ! in_array( $data[ $key ], $valid_state_values, true ) ) {
|
||||
/* translators: 1: state field 2: valid states */
|
||||
$errors->add( 'validation', sprintf( __( '%1$s is not valid. Please enter one of the following: %2$s', 'woocommerce' ), '<strong>' . esc_html( $field_label ) . '</strong>', implode( ', ', $valid_states ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $required && '' === $data[ $key ] ) {
|
||||
if ( $validate_fieldset && $required && '' === $data[ $key ] ) {
|
||||
/* translators: %s: field name */
|
||||
$errors->add( 'required-field', apply_filters( 'woocommerce_checkout_required_field_notice', sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . esc_html( $field_label ) . '</strong>' ), $field_label ) );
|
||||
}
|
||||
|
@ -976,9 +977,7 @@ class WC_Checkout {
|
|||
if ( is_ajax() ) {
|
||||
// Only print notices if not reloading the checkout, otherwise they're lost in the page reload.
|
||||
if ( ! isset( WC()->session->reload_checkout ) ) {
|
||||
ob_start();
|
||||
wc_print_notices();
|
||||
$messages = ob_get_clean();
|
||||
$messages = wc_print_notices( true );
|
||||
}
|
||||
|
||||
$response = array(
|
||||
|
|
|
@ -118,6 +118,7 @@ class WC_Countries {
|
|||
'KR' => array(),
|
||||
'KW' => array(),
|
||||
'LB' => array(),
|
||||
'LU' => array(),
|
||||
'MQ' => array(),
|
||||
'NL' => array(),
|
||||
'NO' => array(),
|
||||
|
@ -1096,6 +1097,11 @@ class WC_Countries {
|
|||
'required' => false,
|
||||
),
|
||||
),
|
||||
'LU' => array(
|
||||
'state' => array(
|
||||
'required' => false,
|
||||
),
|
||||
),
|
||||
'MD' => array(
|
||||
'state' => array(
|
||||
'label' => __( 'Municipality / District', 'woocommerce' ),
|
||||
|
|
|
@ -17,7 +17,7 @@ class WC_Discounts {
|
|||
* Reference to cart or order object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @var array
|
||||
* @var WC_Cart|WC_Order
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
|
@ -36,11 +36,11 @@ class WC_Discounts {
|
|||
protected $discounts = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* WC_Discounts Constructor.
|
||||
*
|
||||
* @param array $object Cart or order object.
|
||||
* @param WC_Cart|WC_Order $object Cart or order object.
|
||||
*/
|
||||
public function __construct( $object = array() ) {
|
||||
public function __construct( $object = null ) {
|
||||
if ( is_a( $object, 'WC_Cart' ) ) {
|
||||
$this->set_items_from_cart( $object );
|
||||
} elseif ( is_a( $object, 'WC_Order' ) ) {
|
||||
|
@ -93,7 +93,7 @@ class WC_Discounts {
|
|||
* Normalise order items which will be discounted.
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @param array $order Cart object.
|
||||
* @param WC_Order $order Order object.
|
||||
*/
|
||||
public function set_items_from_order( $order ) {
|
||||
$this->items = array();
|
||||
|
@ -239,6 +239,7 @@ class WC_Discounts {
|
|||
* @since 3.2.0
|
||||
* @param WC_Coupon $coupon Coupon object being applied to the items.
|
||||
* @param bool $validate Set to false to skip coupon validation.
|
||||
* @throws Exception Error message when coupon isn't valid.
|
||||
* @return bool|WP_Error True if applied or WP_Error instance in failure.
|
||||
*/
|
||||
public function apply_coupon( $coupon, $validate = true ) {
|
||||
|
@ -257,7 +258,6 @@ class WC_Discounts {
|
|||
}
|
||||
|
||||
$items_to_apply = $this->get_items_to_apply_coupon( $coupon );
|
||||
$coupon_type = $coupon->get_discount_type();
|
||||
|
||||
// Core discounts are handled here as of 3.2.
|
||||
switch ( $coupon->get_discount_type() ) {
|
||||
|
|
|
@ -167,7 +167,7 @@ class WC_Frontend_Scripts {
|
|||
'flexslider' => array(
|
||||
'src' => self::get_asset_url( 'assets/js/flexslider/jquery.flexslider' . $suffix . '.js' ),
|
||||
'deps' => array( 'jquery' ),
|
||||
'version' => '2.7.0',
|
||||
'version' => '2.7.1',
|
||||
),
|
||||
'js-cookie' => array(
|
||||
'src' => self::get_asset_url( 'assets/js/js-cookie/js.cookie' . $suffix . '.js' ),
|
||||
|
|
|
@ -155,13 +155,19 @@ class WC_Install {
|
|||
* This function is hooked into admin_init to affect admin only.
|
||||
*/
|
||||
public static function install_actions() {
|
||||
if ( ! empty( $_GET['do_update_woocommerce'] ) ) { // WPCS: input var ok, CSRF ok.
|
||||
if ( ! empty( $_GET['do_update_woocommerce'] ) ) { // WPCS: input var ok.
|
||||
check_admin_referer( 'wc_db_update', 'wc_db_update_nonce' );
|
||||
self::update();
|
||||
WC_Admin_Notices::add_notice( 'update' );
|
||||
}
|
||||
if ( ! empty( $_GET['force_update_woocommerce'] ) ) { // WPCS: input var ok, CSRF ok.
|
||||
if ( ! empty( $_GET['force_update_woocommerce'] ) ) { // WPCS: input var ok.
|
||||
check_admin_referer( 'wc_force_db_update', 'wc_force_db_update_nonce' );
|
||||
$blog_id = get_current_blog_id();
|
||||
|
||||
// Used to fire an action added in WP_Background_Process::_construct() that calls WP_Background_Process::handle_cron_healthcheck().
|
||||
// This method will make sure the database updates are executed even if cron is disabled. Nothing will happen if the updates are already running.
|
||||
do_action( 'wp_' . $blog_id . '_wc_updater_cron' );
|
||||
|
||||
wp_safe_redirect( admin_url( 'admin.php?page=wc-settings' ) );
|
||||
exit;
|
||||
}
|
||||
|
@ -544,8 +550,23 @@ class WC_Install {
|
|||
$wpdb->query( "ALTER TABLE {$wpdb->comments} ADD INDEX woo_idx_comment_type (comment_type)" );
|
||||
}
|
||||
|
||||
// Add constraint to download logs.
|
||||
$wpdb->query( "ALTER TABLE {$wpdb->prefix}wc_download_log ADD FOREIGN KEY (permission_id) REFERENCES {$wpdb->prefix}woocommerce_downloadable_product_permissions(permission_id) ON DELETE CASCADE" );
|
||||
// Get tables data types and check it matches before adding constraint.
|
||||
$download_log_columns = $wpdb->get_results( "SHOW COLUMNS FROM {$wpdb->prefix}wc_download_log WHERE Field = 'permission_id'", ARRAY_A );
|
||||
$download_log_column_type = '';
|
||||
if ( isset( $download_log_columns[0]['Type'] ) ) {
|
||||
$download_log_column_type = $download_log_columns[0]['Type'];
|
||||
}
|
||||
|
||||
$download_permissions_columns = $wpdb->get_results( "SHOW COLUMNS FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE Field = 'permission_id'", ARRAY_A );
|
||||
$download_permissions_column_type = '';
|
||||
if ( isset( $download_permissions_columns[0]['Type'] ) ) {
|
||||
$download_permissions_column_type = $download_permissions_columns[0]['Type'];
|
||||
}
|
||||
|
||||
// Add constraint to download logs if the columns matches.
|
||||
if ( ! empty( $download_permissions_column_type ) && ! empty( $download_log_column_type ) && $download_permissions_column_type === $download_log_column_type ) {
|
||||
$wpdb->query( "ALTER TABLE {$wpdb->prefix}wc_download_log ADD FOREIGN KEY (permission_id) REFERENCES {$wpdb->prefix}woocommerce_downloadable_product_permissions(permission_id) ON DELETE CASCADE" );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,7 +45,7 @@ class WC_Meta_Data implements JsonSerializable {
|
|||
/**
|
||||
* When converted to JSON.
|
||||
*
|
||||
* @return object
|
||||
* @return object|array
|
||||
*/
|
||||
public function jsonSerialize() {
|
||||
return $this->get_data();
|
||||
|
@ -73,6 +73,8 @@ class WC_Meta_Data implements JsonSerializable {
|
|||
* by `empty` and `isset`.
|
||||
*
|
||||
* @param string $key Key to check if set.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function __isset( $key ) {
|
||||
return array_key_exists( $key, $this->current_data );
|
||||
|
|
|
@ -78,6 +78,8 @@ class WC_Order_Query extends WC_Object_Query {
|
|||
* Get orders matching the current query vars.
|
||||
*
|
||||
* @return array|object of WC_Order objects
|
||||
*
|
||||
* @throws Exception When WC_Data_Store validation fails.
|
||||
*/
|
||||
public function get_orders() {
|
||||
$args = apply_filters( 'woocommerce_order_query_args', $this->get_query_vars() );
|
||||
|
|
|
@ -17,10 +17,9 @@ class WC_Privacy_Exporters {
|
|||
*
|
||||
* @since 3.4.0
|
||||
* @param string $email_address The user email address.
|
||||
* @param int $page Page.
|
||||
* @return array An array of personal data in name value pairs
|
||||
*/
|
||||
public static function customer_data_exporter( $email_address, $page ) {
|
||||
public static function customer_data_exporter( $email_address ) {
|
||||
$user = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data.
|
||||
$data_to_export = array();
|
||||
|
||||
|
@ -53,7 +52,7 @@ class WC_Privacy_Exporters {
|
|||
* @return array An array of personal data in name value pairs
|
||||
*/
|
||||
public static function order_data_exporter( $email_address, $page ) {
|
||||
$done = false;
|
||||
$done = true;
|
||||
$page = (int) $page;
|
||||
$user = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data.
|
||||
$data_to_export = array();
|
||||
|
@ -79,8 +78,6 @@ class WC_Privacy_Exporters {
|
|||
);
|
||||
}
|
||||
$done = 10 > count( $orders );
|
||||
} else {
|
||||
$done = true;
|
||||
}
|
||||
|
||||
return array(
|
||||
|
@ -95,10 +92,11 @@ class WC_Privacy_Exporters {
|
|||
* @since 3.4.0
|
||||
* @param string $email_address The user email address.
|
||||
* @param int $page Page.
|
||||
* @throws Exception When WC_Data_Store validation fails.
|
||||
* @return array An array of personal data in name value pairs
|
||||
*/
|
||||
public static function download_data_exporter( $email_address, $page ) {
|
||||
$done = false;
|
||||
$done = true;
|
||||
$page = (int) $page;
|
||||
$user = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data.
|
||||
$data_to_export = array();
|
||||
|
@ -153,8 +151,6 @@ class WC_Privacy_Exporters {
|
|||
}
|
||||
}
|
||||
$done = 10 > count( $downloads );
|
||||
} else {
|
||||
$done = true;
|
||||
}
|
||||
|
||||
return array(
|
||||
|
@ -168,6 +164,7 @@ class WC_Privacy_Exporters {
|
|||
*
|
||||
* @since 3.4.0
|
||||
* @param WP_User $user user object.
|
||||
* @throws Exception If customer cannot be read/found and $data is set to WC_Customer class.
|
||||
* @return array
|
||||
*/
|
||||
protected static function get_customer_personal_data( $user ) {
|
||||
|
|
|
@ -515,7 +515,11 @@ class WC_Query {
|
|||
global $wpdb, $wp_query;
|
||||
|
||||
if ( isset( $wp_query->queried_object, $wp_query->queried_object->term_taxonomy_id, $wp_query->queried_object->taxonomy ) && is_a( $wp_query->queried_object, 'WP_Term' ) ) {
|
||||
$search_within_terms = get_term_children( $wp_query->queried_object->term_taxonomy_id, $wp_query->queried_object->taxonomy );
|
||||
$search_within_terms = get_terms( array(
|
||||
'taxonomy' => $wp_query->queried_object->taxonomy,
|
||||
'parent' => $wp_query->queried_object->term_id,
|
||||
'fields' => 'tt_ids',
|
||||
) );
|
||||
$search_within_terms[] = $wp_query->queried_object->term_taxonomy_id;
|
||||
$args['join'] .= " INNER JOIN (
|
||||
SELECT post_id, min( meta_value+0 ) price
|
||||
|
@ -544,7 +548,11 @@ class WC_Query {
|
|||
global $wpdb, $wp_query;
|
||||
|
||||
if ( isset( $wp_query->queried_object, $wp_query->queried_object->term_taxonomy_id, $wp_query->queried_object->taxonomy ) && is_a( $wp_query->queried_object, 'WP_Term' ) ) {
|
||||
$search_within_terms = get_term_children( $wp_query->queried_object->term_taxonomy_id, $wp_query->queried_object->taxonomy );
|
||||
$search_within_terms = get_terms( array(
|
||||
'taxonomy' => $wp_query->queried_object->taxonomy,
|
||||
'parent' => $wp_query->queried_object->term_id,
|
||||
'fields' => 'tt_ids',
|
||||
) );
|
||||
$search_within_terms[] = $wp_query->queried_object->term_taxonomy_id;
|
||||
$args['join'] .= " INNER JOIN (
|
||||
SELECT post_id, max( meta_value+0 ) price
|
||||
|
|
|
@ -585,9 +585,7 @@ class WC_Shortcodes {
|
|||
* @return string
|
||||
*/
|
||||
public static function shop_messages() {
|
||||
ob_start();
|
||||
wc_print_notices();
|
||||
return '<div class="woocommerce">' . ob_get_clean() . '</div>';
|
||||
return '<div class="woocommerce">' . wc_print_notices( true ) . '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1398,7 +1398,7 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
|
|||
}
|
||||
}
|
||||
|
||||
if ( $search_queries ) {
|
||||
if ( ! empty( $search_queries ) ) {
|
||||
$search_where = 'AND (' . implode( ') OR (', $search_queries ) . ')';
|
||||
}
|
||||
|
||||
|
|
|
@ -79,8 +79,6 @@ class WC_Shortcode_Checkout {
|
|||
|
||||
do_action( 'before_woocommerce_pay' );
|
||||
|
||||
wc_print_notices();
|
||||
|
||||
$order_id = absint( $order_id );
|
||||
|
||||
// Pay for existing order.
|
||||
|
@ -152,7 +150,7 @@ class WC_Shortcode_Checkout {
|
|||
);
|
||||
|
||||
} catch ( Exception $e ) {
|
||||
wc_add_notice( $e->getMessage(), 'error' );
|
||||
wc_print_notice( $e->getMessage(), 'error' );
|
||||
}
|
||||
} elseif ( $order_id ) {
|
||||
|
||||
|
@ -168,17 +166,15 @@ class WC_Shortcode_Checkout {
|
|||
|
||||
} else {
|
||||
/* translators: %s: order status */
|
||||
wc_add_notice( sprintf( __( 'This order’s status is “%s”—it cannot be paid for. Please contact us if you need assistance.', 'woocommerce' ), wc_get_order_status_name( $order->get_status() ) ), 'error' );
|
||||
wc_print_notice( sprintf( __( 'This order’s status is “%s”—it cannot be paid for. Please contact us if you need assistance.', 'woocommerce' ), wc_get_order_status_name( $order->get_status() ) ), 'error' );
|
||||
}
|
||||
} else {
|
||||
wc_add_notice( __( 'Sorry, this order is invalid and cannot be paid for.', 'woocommerce' ), 'error' );
|
||||
wc_print_notice( __( 'Sorry, this order is invalid and cannot be paid for.', 'woocommerce' ), 'error' );
|
||||
}
|
||||
} else {
|
||||
wc_add_notice( __( 'Invalid order.', 'woocommerce' ), 'error' );
|
||||
wc_print_notice( __( 'Invalid order.', 'woocommerce' ), 'error' );
|
||||
}
|
||||
|
||||
wc_print_notices();
|
||||
|
||||
do_action( 'after_woocommerce_pay' );
|
||||
}
|
||||
|
||||
|
@ -188,9 +184,6 @@ class WC_Shortcode_Checkout {
|
|||
* @param int $order_id Order ID.
|
||||
*/
|
||||
private static function order_received( $order_id = 0 ) {
|
||||
|
||||
wc_print_notices();
|
||||
|
||||
$order = false;
|
||||
|
||||
// Get the order.
|
||||
|
@ -217,10 +210,6 @@ class WC_Shortcode_Checkout {
|
|||
* Show the checkout.
|
||||
*/
|
||||
private static function checkout() {
|
||||
|
||||
// Show non-cart errors.
|
||||
wc_print_notices();
|
||||
|
||||
// Check cart has contents.
|
||||
if ( WC()->cart->is_empty() && ! is_customize_preview() && ! apply_filters( 'woocommerce_checkout_skip_cart_is_empty_check', false ) ) {
|
||||
return;
|
||||
|
|
|
@ -377,22 +377,15 @@ class WC_Shortcode_My_Account {
|
|||
* Show the add payment method page.
|
||||
*/
|
||||
public static function add_payment_method() {
|
||||
|
||||
if ( ! is_user_logged_in() ) {
|
||||
|
||||
wp_safe_redirect( wc_get_page_permalink( 'myaccount' ) );
|
||||
exit();
|
||||
|
||||
} else {
|
||||
|
||||
do_action( 'before_woocommerce_add_payment_method' );
|
||||
|
||||
wc_print_notices();
|
||||
|
||||
wc_get_template( 'myaccount/form-add-payment-method.php' );
|
||||
|
||||
do_action( 'after_woocommerce_add_payment_method' );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,9 +45,9 @@ class WC_Shortcode_Order_Tracking {
|
|||
$order_email = empty( $_REQUEST['order_email'] ) ? '' : sanitize_email( wp_unslash( $_REQUEST['order_email'] ) ); // WPCS: input var ok.
|
||||
|
||||
if ( ! $order_id ) {
|
||||
wc_add_notice( __( 'Please enter a valid order ID', 'woocommerce' ), 'error' );
|
||||
wc_print_notice( __( 'Please enter a valid order ID', 'woocommerce' ), 'error' );
|
||||
} elseif ( ! $order_email ) {
|
||||
wc_add_notice( __( 'Please enter a valid email address', 'woocommerce' ), 'error' );
|
||||
wc_print_notice( __( 'Please enter a valid email address', 'woocommerce' ), 'error' );
|
||||
} else {
|
||||
$order = wc_get_order( apply_filters( 'woocommerce_shortcode_order_tracking_order_id', $order_id ) );
|
||||
|
||||
|
@ -60,13 +60,11 @@ class WC_Shortcode_Order_Tracking {
|
|||
);
|
||||
return;
|
||||
} else {
|
||||
wc_add_notice( __( 'Sorry, the order could not be found. Please contact us if you are having difficulty finding your order details.', 'woocommerce' ), 'error' );
|
||||
wc_print_notice( __( 'Sorry, the order could not be found. Please contact us if you are having difficulty finding your order details.', 'woocommerce' ), 'error' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wc_print_notices();
|
||||
|
||||
wc_get_template( 'order/form-tracking.php' );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ class WC_Twenty_Seventeen {
|
|||
'deps' => '',
|
||||
'version' => WC_VERSION,
|
||||
'media' => 'all',
|
||||
'has_rtl' => true,
|
||||
);
|
||||
|
||||
return apply_filters( 'woocommerce_twenty_seventeen_styles', $styles );
|
||||
|
|
|
@ -262,7 +262,7 @@ if ( ! function_exists( 'is_ajax' ) ) {
|
|||
* @return bool
|
||||
*/
|
||||
function is_ajax() {
|
||||
return defined( 'DOING_AJAX' );
|
||||
return function_exists( 'wp_doing_ajax' ) ? wp_doing_ajax() : defined( 'DOING_AJAX' );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,6 @@ function wc_update_order( $args ) {
|
|||
*
|
||||
* WC_TEMPLATE_DEBUG_MODE will prevent overrides in themes from taking priority.
|
||||
*
|
||||
* @access public
|
||||
* @param mixed $slug Template slug.
|
||||
* @param string $name Template name (default: '').
|
||||
*/
|
||||
|
@ -183,7 +182,6 @@ function wc_get_template_part( $slug, $name = '' ) {
|
|||
/**
|
||||
* Get other templates (e.g. product attributes) passing attributes and including the file.
|
||||
*
|
||||
* @access public
|
||||
* @param string $template_name Template name.
|
||||
* @param array $args Arguments. (default: array).
|
||||
* @param string $template_path Template path. (default: '').
|
||||
|
@ -239,7 +237,6 @@ function wc_get_template_html( $template_name, $args = array(), $template_path =
|
|||
* yourtheme/$template_name
|
||||
* $default_path/$template_name
|
||||
*
|
||||
* @access public
|
||||
* @param string $template_name Template name.
|
||||
* @param string $template_path Template path. (default: '').
|
||||
* @param string $default_path Default path. (default: '').
|
||||
|
@ -1636,30 +1633,30 @@ function wc_get_logger() {
|
|||
|
||||
$class = apply_filters( 'woocommerce_logging_class', 'WC_Logger' );
|
||||
|
||||
if ( null === $logger || ! is_a( $logger, $class ) ) {
|
||||
$implements = class_implements( $class );
|
||||
|
||||
if ( is_array( $implements ) && in_array( 'WC_Logger_Interface', $implements, true ) ) {
|
||||
if ( is_object( $class ) ) {
|
||||
$logger = $class;
|
||||
} else {
|
||||
$logger = new $class();
|
||||
}
|
||||
} else {
|
||||
wc_doing_it_wrong(
|
||||
__FUNCTION__,
|
||||
sprintf(
|
||||
/* translators: 1: class name 2: woocommerce_logging_class 3: WC_Logger_Interface */
|
||||
__( 'The class %1$s provided by %2$s filter must implement %3$s.', 'woocommerce' ),
|
||||
'<code>' . esc_html( is_object( $class ) ? get_class( $class ) : $class ) . '</code>',
|
||||
'<code>woocommerce_logging_class</code>',
|
||||
'<code>WC_Logger_Interface</code>'
|
||||
),
|
||||
'3.0'
|
||||
);
|
||||
$logger = is_a( $logger, 'WC_Logger' ) ? $logger : new WC_Logger();
|
||||
}
|
||||
if ( null !== $logger && is_a( $logger, $class ) ) {
|
||||
return $logger;
|
||||
}
|
||||
|
||||
$implements = class_implements( $class );
|
||||
|
||||
if ( is_array( $implements ) && in_array( 'WC_Logger_Interface', $implements, true ) ) {
|
||||
$logger = is_object( $class ) ? $class : new $class();
|
||||
} else {
|
||||
wc_doing_it_wrong(
|
||||
__FUNCTION__,
|
||||
sprintf(
|
||||
/* translators: 1: class name 2: woocommerce_logging_class 3: WC_Logger_Interface */
|
||||
__( 'The class %1$s provided by %2$s filter must implement %3$s.', 'woocommerce' ),
|
||||
'<code>' . esc_html( is_object( $class ) ? get_class( $class ) : $class ) . '</code>',
|
||||
'<code>woocommerce_logging_class</code>',
|
||||
'<code>WC_Logger_Interface</code>'
|
||||
),
|
||||
'3.0'
|
||||
);
|
||||
|
||||
$logger = is_a( $logger, 'WC_Logger' ) ? $logger : new WC_Logger();
|
||||
}
|
||||
|
||||
return $logger;
|
||||
}
|
||||
|
||||
|
|
|
@ -119,8 +119,10 @@ function wc_clear_notices() {
|
|||
* Prints messages and errors which are stored in the session, then clears them.
|
||||
*
|
||||
* @since 2.1
|
||||
* @param bool $return true to return rather than echo. @since 3.5.0.
|
||||
* @return string|null
|
||||
*/
|
||||
function wc_print_notices() {
|
||||
function wc_print_notices( $return = false ) {
|
||||
if ( ! did_action( 'woocommerce_init' ) ) {
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
|
||||
return;
|
||||
|
@ -129,6 +131,9 @@ function wc_print_notices() {
|
|||
$all_notices = WC()->session->get( 'wc_notices', array() );
|
||||
$notice_types = apply_filters( 'woocommerce_notice_types', array( 'error', 'success', 'notice' ) );
|
||||
|
||||
// Buffer output.
|
||||
ob_start();
|
||||
|
||||
foreach ( $notice_types as $notice_type ) {
|
||||
if ( wc_notice_count( $notice_type ) > 0 ) {
|
||||
wc_get_template( "notices/{$notice_type}.php", array(
|
||||
|
@ -138,10 +143,15 @@ function wc_print_notices() {
|
|||
}
|
||||
|
||||
wc_clear_notices();
|
||||
|
||||
$notices = wp_kses_post( ob_get_clean() );
|
||||
|
||||
if ( $return ) {
|
||||
return $notices;
|
||||
}
|
||||
|
||||
echo $notices; // WPCS: XSS ok.
|
||||
}
|
||||
add_action( 'woocommerce_shortcode_before_product_cat_loop', 'wc_print_notices', 10 );
|
||||
add_action( 'woocommerce_before_shop_loop', 'wc_print_notices', 10 );
|
||||
add_action( 'woocommerce_before_single_product', 'wc_print_notices', 10 );
|
||||
|
||||
/**
|
||||
* Print a single notice immediately.
|
||||
|
|
|
@ -3346,6 +3346,17 @@ function wc_get_cart_undo_url( $cart_item_key ) {
|
|||
return apply_filters( 'woocommerce_get_undo_url', $cart_page_url ? wp_nonce_url( add_query_arg( $query_args, $cart_page_url ), 'woocommerce-cart' ) : '', $cart_item_key );
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs all queued notices on WC pages.
|
||||
*
|
||||
* @since 3.5.0
|
||||
*/
|
||||
function woocommerce_output_all_notices() {
|
||||
echo '<div class="woocommerce-notices-wrapper">';
|
||||
wc_print_notices();
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Products RSS Feed.
|
||||
*
|
||||
|
|
|
@ -288,3 +288,14 @@ add_action( 'woocommerce_account_payment-methods_endpoint', 'woocommerce_account
|
|||
add_action( 'woocommerce_account_add-payment-method_endpoint', 'woocommerce_account_add_payment_method' );
|
||||
add_action( 'woocommerce_account_edit-account_endpoint', 'woocommerce_account_edit_account' );
|
||||
add_action( 'woocommerce_register_form', 'wc_registration_privacy_policy_text', 20 );
|
||||
|
||||
/**
|
||||
* Notices.
|
||||
*/
|
||||
add_action( 'woocommerce_cart_is_empty', 'woocommerce_output_all_notices', 10 );
|
||||
add_action( 'woocommerce_shortcode_before_product_cat_loop', 'woocommerce_output_all_notices', 10 );
|
||||
add_action( 'woocommerce_before_shop_loop', 'woocommerce_output_all_notices', 10 );
|
||||
add_action( 'woocommerce_before_single_product', 'woocommerce_output_all_notices', 10 );
|
||||
add_action( 'woocommerce_before_cart', 'woocommerce_output_all_notices', 10 );
|
||||
add_action( 'woocommerce_before_checkout_form', 'woocommerce_output_all_notices', 10 );
|
||||
add_action( 'woocommerce_account_content', 'woocommerce_output_all_notices', 10 );
|
||||
|
|
|
@ -520,13 +520,7 @@ add_action( 'deleted_user', 'wc_reset_order_customer_id_on_deleted_user' );
|
|||
*/
|
||||
function wc_review_is_from_verified_owner( $comment_id ) {
|
||||
$verified = get_comment_meta( $comment_id, 'verified', true );
|
||||
|
||||
// If no "verified" meta is present, generate it (if this is a product review).
|
||||
if ( '' === $verified ) {
|
||||
$verified = WC_Comments::add_comment_purchase_verification( $comment_id );
|
||||
}
|
||||
|
||||
return (bool) $verified;
|
||||
return '' === $verified ? WC_Comments::add_comment_purchase_verification( $comment_id ) : (bool) $verified;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -572,16 +566,10 @@ add_action( 'profile_update', 'wc_update_profile_last_update_time', 10, 2 );
|
|||
*/
|
||||
function wc_meta_update_last_update_time( $meta_id, $user_id, $meta_key, $_meta_value ) {
|
||||
$keys_to_track = apply_filters( 'woocommerce_user_last_update_fields', array( 'first_name', 'last_name' ) );
|
||||
$update_time = false;
|
||||
if ( in_array( $meta_key, $keys_to_track, true ) ) {
|
||||
$update_time = true;
|
||||
}
|
||||
if ( 'billing_' === substr( $meta_key, 0, 8 ) ) {
|
||||
$update_time = true;
|
||||
}
|
||||
if ( 'shipping_' === substr( $meta_key, 0, 9 ) ) {
|
||||
$update_time = true;
|
||||
}
|
||||
|
||||
$update_time = in_array( $meta_key, $keys_to_track, true ) ? true : false;
|
||||
$update_time = 'billing_' === substr( $meta_key, 0, 8 ) ? true : $update_time;
|
||||
$update_time = 'shipping_' === substr( $meta_key, 0, 9 ) ? true : $update_time;
|
||||
|
||||
if ( $update_time ) {
|
||||
wc_set_user_last_update_time( $user_id );
|
||||
|
|
|
@ -35,6 +35,7 @@ add_action( 'woocommerce_webhook_process_delivery', 'wc_webhook_process_delivery
|
|||
*
|
||||
* @since 2.2.0
|
||||
* @param int $webhook_id Webhook ID to deliver.
|
||||
* @throws Exception If webhook cannot be read/found and $data parameter of WC_Webhook class constructor is set.
|
||||
* @param mixed $arg Hook argument.
|
||||
*/
|
||||
function wc_deliver_webhook_async( $webhook_id, $arg ) {
|
||||
|
@ -94,6 +95,7 @@ function wc_get_webhook_statuses() {
|
|||
* Load webhooks.
|
||||
*
|
||||
* @since 3.3.0
|
||||
* @throws Exception If webhook cannot be read/found and $data parameter of WC_Webhook class constructor is set.
|
||||
* @return bool
|
||||
*/
|
||||
function wc_load_webhooks() {
|
||||
|
@ -114,6 +116,7 @@ function wc_load_webhooks() {
|
|||
* Get webhook.
|
||||
*
|
||||
* @param int|WC_Webhook $id Webhook ID or object.
|
||||
* @throws Exception If webhook cannot be read/found and $data parameter of WC_Webhook class constructor is set.
|
||||
* @return WC_Webhook|null
|
||||
*/
|
||||
function wc_get_webhook( $id ) {
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
</rule>
|
||||
<rule ref="WordPress.XSS.EscapeOutput">
|
||||
<properties>
|
||||
<property name="customEscapingFunctions" type="array" value="wc_help_tip,wc_sanitize_tooltip" />
|
||||
<property name="customEscapingFunctions" type="array" value="wc_help_tip,wc_sanitize_tooltip,wc_selected" />
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="WordPress.WP.I18n">
|
||||
|
|
|
@ -20,8 +20,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
wc_print_notices();
|
||||
|
||||
/**
|
||||
* @hooked wc_empty_cart_message - 10
|
||||
*/
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
wc_print_notices();
|
||||
|
||||
do_action( 'woocommerce_before_cart' ); ?>
|
||||
|
||||
<form class="woocommerce-cart-form" action="<?php echo esc_url( wc_get_cart_url() ); ?>" method="post">
|
||||
|
@ -88,7 +86,7 @@ do_action( 'woocommerce_before_cart' ); ?>
|
|||
|
||||
// Backorder notification.
|
||||
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) {
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_backorder_notification', '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'woocommerce' ) . '</p>' ) );
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_backorder_notification', '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'woocommerce' ) . '</p>', $product_id ) );
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
|
|
@ -10,21 +10,15 @@
|
|||
* 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
|
||||
* @version 2.4.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
?>
|
||||
|
||||
<?php wc_print_notices(); ?>
|
||||
|
||||
<p><?php _e( 'There are some issues with the items in your cart (shown above). Please go back to the cart page and resolve these issues before checking out.', 'woocommerce' ) ?></p>
|
||||
<p><?php _e( 'There are some issues with the items in your cart. Please go back to the cart page and resolve these issues before checking out.', 'woocommerce' ) ?></p>
|
||||
|
||||
<?php do_action( 'woocommerce_cart_has_errors' ); ?>
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
exit;
|
||||
}
|
||||
|
||||
wc_print_notices();
|
||||
|
||||
do_action( 'woocommerce_before_checkout_form', $checkout );
|
||||
|
||||
// If checkout registration is disabled and not logged in, the user cannot checkout
|
||||
|
|
|
@ -18,7 +18,7 @@ if ( apply_filters( 'woocommerce_checkout_show_terms', true ) && function_exists
|
|||
* Terms and conditions hook used to inject content.
|
||||
*
|
||||
* @since 3.4.0.
|
||||
* @hooked wc_privacy_policy_text() Shows custom privacy policy text. Priority 20.
|
||||
* @hooked wc_checkout_privacy_policy_text() Shows custom privacy policy text. Priority 20.
|
||||
* @hooked wc_terms_and_conditions_page_content() Shows t&c page content. Priority 30.
|
||||
*/
|
||||
do_action( 'woocommerce_checkout_terms_and_conditions' );
|
||||
|
|
|
@ -19,11 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php wc_print_notices(); ?>
|
||||
|
||||
<?php do_action( 'woocommerce_before_customer_login_form' ); ?>
|
||||
do_action( 'woocommerce_before_customer_login_form' ); ?>
|
||||
|
||||
<?php if ( get_option( 'woocommerce_enable_myaccount_registration' ) === 'yes' ) : ?>
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
wc_print_notices(); ?>
|
||||
?>
|
||||
|
||||
<form method="post" class="woocommerce-ResetPassword lost_reset_password">
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
wc_print_notices(); ?>
|
||||
?>
|
||||
|
||||
<form method="post" class="woocommerce-ResetPassword lost_reset_password">
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
exit;
|
||||
}
|
||||
|
||||
wc_print_notices();
|
||||
wc_print_notice( __( 'Password reset email has been sent.', 'woocommerce' ) );
|
||||
?>
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
exit;
|
||||
}
|
||||
|
||||
wc_print_notices();
|
||||
|
||||
/**
|
||||
* My Account navigation.
|
||||
* @since 2.6.0
|
||||
|
|
|
@ -26,4 +26,9 @@ if [ $1 == 'after' ]; then
|
|||
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
|
||||
fi
|
||||
|
||||
if [[ ${RUN_E2E} == 1 && $(ls -A $TRAVIS_BUILD_DIR/screenshots) ]]; then
|
||||
curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash
|
||||
artifacts upload
|
||||
fi
|
||||
|
||||
fi
|
||||
|
|
|
@ -105,6 +105,13 @@ test.describe( 'Cart page', function() {
|
|||
);
|
||||
} );
|
||||
|
||||
// take screenshot
|
||||
test.afterEach( function() {
|
||||
if ( this.currentTest.state === 'failed' ) {
|
||||
helper.takeScreenshot( manager, this.currentTest );
|
||||
}
|
||||
} );
|
||||
|
||||
// quit browser
|
||||
test.after( () => {
|
||||
manager.quitBrowser();
|
||||
|
|
|
@ -150,6 +150,13 @@ test.describe( 'Checkout Page', function() {
|
|||
);
|
||||
} );
|
||||
|
||||
// take screenshot
|
||||
test.afterEach( function() {
|
||||
if ( this.currentTest.state === 'failed' ) {
|
||||
helper.takeScreenshot( manager, this.currentTest );
|
||||
}
|
||||
} );
|
||||
|
||||
// quit browser
|
||||
test.after( () => {
|
||||
manager.quitBrowser();
|
||||
|
|
|
@ -115,6 +115,13 @@ test.describe( 'My account page', function() {
|
|||
assert.eventually.ok( myAccount.hasText( 'Account details' ), 'see "Account details" text' );
|
||||
} );
|
||||
|
||||
// take screenshot
|
||||
test.afterEach( function() {
|
||||
if ( this.currentTest.state === 'failed' ) {
|
||||
helper.takeScreenshot( manager, this.currentTest );
|
||||
}
|
||||
} );
|
||||
|
||||
// quit browser
|
||||
test.after( () => {
|
||||
manager.quitBrowser();
|
||||
|
|
|
@ -61,6 +61,13 @@ test.describe( 'Single Product Page', function() {
|
|||
assert.eventually.ok( visitCart().hasItem( 'Hoodie - Green, No' ), '"Hoodie - Green, No" in the cart' );
|
||||
} );
|
||||
|
||||
// take screenshot
|
||||
test.afterEach( function() {
|
||||
if ( this.currentTest.state === 'failed' ) {
|
||||
helper.takeScreenshot( manager, this.currentTest );
|
||||
}
|
||||
} );
|
||||
|
||||
// quit browser
|
||||
test.after( () => {
|
||||
manager.quitBrowser();
|
||||
|
|
|
@ -46,6 +46,13 @@ test.describe( 'Add New Coupon Page', function() {
|
|||
assert.eventually.ok( couponPage.hasNotice( 'Coupon updated.' ) );
|
||||
} );
|
||||
|
||||
// take screenshot
|
||||
test.afterEach( function() {
|
||||
if ( this.currentTest.state === 'failed' ) {
|
||||
helper.takeScreenshot( manager, this.currentTest );
|
||||
}
|
||||
} );
|
||||
|
||||
// quit browser
|
||||
test.after( () => {
|
||||
manager.quitBrowser();
|
||||
|
|
|
@ -47,6 +47,13 @@ test.describe( 'Add New Order Page', function() {
|
|||
assert.eventually.ok( orderNotes.hasNote( 'Order status changed from Pending payment to Processing.' ) );
|
||||
} );
|
||||
|
||||
// take screenshot
|
||||
test.afterEach( function() {
|
||||
if ( this.currentTest.state === 'failed' ) {
|
||||
helper.takeScreenshot( manager, this.currentTest );
|
||||
}
|
||||
} );
|
||||
|
||||
// quit browser
|
||||
test.after( () => {
|
||||
manager.quitBrowser();
|
||||
|
|
|
@ -123,6 +123,13 @@ test.describe( 'Add New Product Page', function() {
|
|||
assert.eventually.ok( product.hasNotice( '1 product moved to the Trash.' ) );
|
||||
} );
|
||||
|
||||
// take screenshot
|
||||
test.afterEach( function() {
|
||||
if ( this.currentTest.state === 'failed' ) {
|
||||
helper.takeScreenshot( manager, this.currentTest );
|
||||
}
|
||||
} );
|
||||
|
||||
// quit browser
|
||||
test.after( () => {
|
||||
manager.quitBrowser();
|
||||
|
|
|
@ -66,6 +66,13 @@ test.describe( 'WooCommerce General Settings', function() {
|
|||
assert.eventually.ok( settings.hasNotice( 'Your settings have been saved.' ) );
|
||||
} );
|
||||
|
||||
// take screenshot
|
||||
test.afterEach( function() {
|
||||
if ( this.currentTest.state === 'failed' ) {
|
||||
helper.takeScreenshot( manager, this.currentTest );
|
||||
}
|
||||
} );
|
||||
|
||||
// quit browser
|
||||
test.after( () => {
|
||||
manager.quitBrowser();
|
||||
|
|
|
@ -51,6 +51,13 @@ test.describe( 'WooCommerce Products > Downloadable Products Settings', function
|
|||
assert.eventually.ok( settings.hasNotice( 'Your settings have been saved.' ) );
|
||||
} );
|
||||
|
||||
// take screenshot
|
||||
test.afterEach( function() {
|
||||
if ( this.currentTest.state === 'failed' ) {
|
||||
helper.takeScreenshot( manager, this.currentTest );
|
||||
}
|
||||
} );
|
||||
|
||||
// quit browser
|
||||
test.after( () => {
|
||||
manager.quitBrowser();
|
||||
|
|
|
@ -95,6 +95,13 @@ test.describe( 'WooCommerce Tax Settings', function() {
|
|||
assert.eventually.ifError( settings.hasSubTab( 'Fancy rates' ) );
|
||||
} );
|
||||
|
||||
// take screenshot
|
||||
test.afterEach( function() {
|
||||
if ( this.currentTest.state === 'failed' ) {
|
||||
helper.takeScreenshot( manager, this.currentTest );
|
||||
}
|
||||
} );
|
||||
|
||||
// quit browser
|
||||
test.after( () => {
|
||||
manager.quitBrowser();
|
||||
|
|
|
@ -114,6 +114,20 @@ class WC_Tests_API_Orders extends WC_REST_Unit_Test_Case {
|
|||
$this->assertEquals( 404, $response->get_status() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests getting an order with an invalid ID.
|
||||
* @since 3.5.0
|
||||
*/
|
||||
public function test_get_item_refund_id() {
|
||||
wp_set_current_user( $this->user );
|
||||
$order = WC_Helper_Order::create_order();
|
||||
$refund = wc_create_refund( array(
|
||||
'order_id' => $order->get_id(),
|
||||
) );
|
||||
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/orders/' . $refund->get_id() ) );
|
||||
$this->assertEquals( 404, $response->get_status() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests creating an order.
|
||||
* @since 3.0.0
|
||||
|
|
|
@ -58,11 +58,11 @@ class WC_Test_Privacy_Export extends WC_Unit_Test_Case {
|
|||
*/
|
||||
public function test_customer_data_exporter() {
|
||||
// Test a non existing user.
|
||||
$response = WC_Privacy_Exporters::customer_data_exporter( 'doesnotexist@test.com', 1 );
|
||||
$response = WC_Privacy_Exporters::customer_data_exporter( 'doesnotexist@test.com' );
|
||||
$this->assertEquals( array(), $response['data'] );
|
||||
|
||||
// Do a test export and check response.
|
||||
$response = WC_Privacy_Exporters::customer_data_exporter( 'test1@test.com', 1 );
|
||||
$response = WC_Privacy_Exporters::customer_data_exporter( 'test1@test.com' );
|
||||
$this->assertTrue( $response['done'] );
|
||||
$this->assertEquals(
|
||||
array(
|
||||
|
|
|
@ -122,17 +122,6 @@ class WC_Tests_Notice_Functions extends WC_Unit_Test_Case {
|
|||
$this->assertEmpty( WC()->session->get( 'wc_notices' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test actions that print the notices.
|
||||
*
|
||||
* @since 2.2
|
||||
*/
|
||||
public function test_wc_print_notices_actions() {
|
||||
|
||||
$this->assertNotFalse( has_action( 'woocommerce_before_shop_loop', 'wc_print_notices' ) );
|
||||
$this->assertNotFalse( has_action( 'woocommerce_before_single_product', 'wc_print_notices' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test wc_print_notice() w/ success type.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue