Код: Выделить всё
add_filter( 'woocommerce_valid_order_statuses_for_cancel', 'custom_valid_order_statuses_for_cancel',1, 2 );
function custom_valid_order_statuses_for_cancel( $statuses, $order ){
// Set HERE the order statuses where you want the cancel button to appear
return array_merge( $statuses, array('processing', 'shipped'));
}
как мне этого добиться, я пытался поместить JavaScript в функцию, но безуспешно
HTML-код для кнопки отмены
Код: Выделить всё
[url=http://localhost/zumra/wordpress/my-account/view-order/1028/]View[/url][url=http://localhost/zumra/wordpress/cart/?cancel_order=true&order=wc_order_CvYEzh8G4OKJ8&order_id=1028&redirect=http%3A%2F%2Flocalhost%2Fzumra%2Fwordpress%2Fmy-account%2F&_wpnonce=938ffd4571]Cancel[/url][url=/zumra/wordpress/my-account/orders/2/?bewpi_action=view&post=1028&nonce=17f4df17bd]Invoice[/url]
Код: Выделить всё
( function($) {
$("#s").autocomplete({
source: product_lib.products_array
});
$('.woocommerce-button button cancel').click(function(e){
e.preventDefault();
if (confirm('are you sure?')) {
$('#idOfTheForm').submit();
}
});
document.getElementsByClassName('woocommerce-button button cancel').onclick = function() {
preventDefault();
alert("button was clicked");
};
window.onload = function() {
if (window.location.href.indexOf("comment") > -1) {
window.location.hash = "#tab-description";
location.reload();
}
}
Подробнее здесь: https://stackoverflow.com/questions/570 ... ncellation
Мобильная версия