Woocommerce: desactivar productes relacionats
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
Vist a https://www.liquidweb.com/kb/disable-related-products-woocommerce-product-pages/
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
Vist a https://www.liquidweb.com/kb/disable-related-products-woocommerce-product-pages/
add_filter('woocommerce_cart_item_permalink','__return_false');
Vist a https://stackoverflow.com/questions/34674698/woocommerce-disable-hyperlink-to-product-on-cart-page
/**
* Don't enqueue Bootstrap on WC Products archive
*/
function dequeue_bootstrap(){
if ( is_page( 'finalitza-la-compra' )) {
// dequeue Bootstrap CSS
function dequeue_bootstrap_css(){
wp_dequeue_style( 'toolset_bootstrap_styles' );
wp_dequeue_style( 'toolset_bootstrap_4' );
}
add_action( 'wp_print_styles', 'dequeue_bootstrap_css' );
// dequeue Bootstrap JS
function dequeue_bootstrap_js(){
wp_dequeue_script( 'toolset_bootstrap' );
wp_dequeue_script( 'toolset_bootstrap_4' );
}
add_action( 'wp_print_scripts', 'dequeue_bootstrap_js' );
}
}
add_action( 'wp_enqueue_scripts', 'dequeue_bootstrap', 100 );
Vist a toolset: https://toolset.com/errata/bootstrap-4-columns-classes-col-1-and-col-2-conflicts-with-woocommerce/
You can follow this thread on WooCommerce GitHub page for a stable solution:
https://github.com/woocommerce/woocommerce/issues/15793As a workaround, for now, you can de-queue Bootstrap on the checkout page using a custom code snippet like this one.
Of course, you’d have to change its condition to is_page( 'checkout' );
.
function edit_price_display($price, $instance) {
global $product;
if(is_singular('product')) {
$price = $product->price;
$price_incl_tax = $price + round($price * ( 21 / 100 ), 2);
$price_incl_tax = number_format($price_incl_tax, 2, ",", ".");
$price = number_format($price, 2, ",", ".");
$display_price = '<span class="price">';
$display_price .= '<span class="amount">€ ' . $price_incl_tax .'<small class="woocommerce-price-suffix"> incl BTW</small></span>';
$display_price .= '<br>';
$display_price .= '<span class="amount">€ ' . $price .'<small class="woocommerce-price-suffix"> excl BTW</small></span>';
$display_price .= '</span>';
echo $display_price;
} else {
echo $price;
}
}
add_filter('woocommerce_get_price_html', 'edit_price_display', 10, 2);
Visto en tomjesch
[cost]*[fee percent="15"]
function wplook_activate_gutenberg_products($can_edit, $post_type){
if($post_type == 'product'){
$can_edit = true;
}
return $can_edit;
}
add_filter('use_block_editor_for_post_type', 'wplook_activate_gutenberg_products', 10, 2);
/**
* @snippet Edit Order Functionality @ WooCommerce My Account Page
* @how-to Get CustomizeWoo.com FREE
* @sourcecode https://businessbloomer.com/?p=91893
* @author Rodolfo Melogli
* @compatible WooCommerce 4.1
* @donate $9 https://businessbloomer.com/bloomer-armada/
*/
// ----------------
// 1. Allow Order Again for Processing Status
add_filter( 'woocommerce_valid_order_statuses_for_order_again', 'bbloomer_order_again_statuses' );
function bbloomer_order_again_statuses( $statuses ) {
$statuses[] = 'processing';
return $statuses;
}
// ----------------
// 2. Add Order Actions @ My Account
add_filter( 'woocommerce_my_account_my_orders_actions', 'bbloomer_add_edit_order_my_account_orders_actions', 50, 2 );
function bbloomer_add_edit_order_my_account_orders_actions( $actions, $order ) {
if ( $order->has_status( 'processing' ) ) {
$actions['edit-order'] = array(
'url' => wp_nonce_url( add_query_arg( array( 'order_again' => $order->get_id(), 'edit_order' => $order->get_id() ) ), 'woocommerce-order_again' ),
'name' => __( 'Edit Order', 'woocommerce' )
);
}
return $actions;
}
// ----------------
// 3. Detect Edit Order Action and Store in Session
add_action( 'woocommerce_cart_loaded_from_session', 'bbloomer_detect_edit_order' );
function bbloomer_detect_edit_order( $cart ) {
if ( isset( $_GET['edit_order'], $_GET['_wpnonce'] ) && is_user_logged_in() && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), 'woocommerce-order_again' ) ) WC()->session->set( 'edit_order', absint( $_GET['edit_order'] ) );
}
// ----------------
// 4. Display Cart Notice re: Edited Order
add_action( 'woocommerce_before_cart', 'bbloomer_show_me_session' );
function bbloomer_show_me_session() {
if ( ! is_cart() ) return;
$edited = WC()->session->get('edit_order');
if ( ! empty( $edited ) ) {
$order = new WC_Order( $edited );
$credit = $order->get_total();
wc_print_notice( 'A credit of ' . wc_price($credit) . ' has been applied to this new order. Feel free to add products to it or change other details such as delivery date.', 'notice' );
}
}
// ----------------
// 5. Calculate New Total if Edited Order
add_action( 'woocommerce_cart_calculate_fees', 'bbloomer_use_edit_order_total', 20, 1 );
function bbloomer_use_edit_order_total( $cart ) {
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return;
$edited = WC()->session->get('edit_order');
if ( ! empty( $edited ) ) {
$order = new WC_Order( $edited );
$credit = -1 * $order->get_total();
$cart->add_fee( 'Credit', $credit );
}
}
// ----------------
// 6. Save Order Action if New Order is Placed
add_action( 'woocommerce_checkout_update_order_meta', 'bbloomer_save_edit_order' );
function bbloomer_save_edit_order( $order_id ) {
$edited = WC()->session->get( 'edit_order' );
if ( ! empty( $edited ) ) {
// update this new order
update_post_meta( $order_id, '_edit_order', $edited );
$neworder = new WC_Order( $order_id );
$oldorder_edit = get_edit_post_link( $edited );
$neworder->add_order_note( 'Order placed after editing. Old order number: <a href="' . $oldorder_edit . '">' . $edited . '</a>' );
// cancel previous order
$oldorder = new WC_Order( $edited );
$neworder_edit = get_edit_post_link( $order_id );
$oldorder->update_status( 'cancelled', 'Order cancelled after editing. New order number: <a href="' . $neworder_edit . '">' . $order_id . '</a> -' );
WC()->session->set( 'edit_order', null );
}
}
Visto en Business Bloomer