Skip to content

Instantly share code, notes, and snippets.

View Spirecool's full-sized avatar

Jérôme OLLIVIER Spirecool

View GitHub Profile
<?php
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
<?php
add_action( 'woocommerce_after_shop_loop_item_title', 'bbloomer_ins_woocommerce_product_excerpt', 35, 2 );
function bbloomer_ins_woocommerce_product_excerpt() {
the_excerpt();
}
<?php
add_filter( 'woocommerce_account_menu_items', 'bbloomer_remove_address_my_account', 9999 );
function bbloomer_remove_address_my_account( $items ) {
unset( $items['edit-address'] );
return $items;
}
/**
<?php
add_filter( 'woocommerce_payment_complete_order_status', 'bbloomer_autocomplete_processing_orders', 9999 );
function bbloomer_autocomplete_processing_orders() {
return 'completed';
}
1 - Mettre la liste de tous les ID des catégories de produits
<?php
add_action( 'product_cat_pre_add_form', 'bbloomer_list_all_product_cat_ids', 5 );
function bbloomer_list_all_product_cat_ids() {
$ids = '';
1 - PHP
<?php
add_action( 'woocommerce_before_shop_loop_item_title', 'bbloomer_display_sold_out_loop_woocommerce' );
function bbloomer_display_sold_out_loop_woocommerce() {
global $product;
if ( ! $product->is_in_stock() ) {
echo '<span class="rupture_de_stock">En rupture de stock !</span>';
<?php
add_action( 'woocommerce_after_shop_loop_item', 'popcorn_show_stock_shop', 10 );
function popcorn_show_stock_shop() {
global $product;
echo wc_get_stock_html( $product );
}
- PHP Snippet #1: Remove a Sorting Option @ WooCommerce Shop
<?php
add_filter( 'woocommerce_catalog_orderby', 'bbloomer_remove_sorting_option_woocommerce_shop' );
function bbloomer_remove_sorting_option_woocommerce_shop( $options ) {
unset( $options['rating'] );
return $options;
<?php
add_action( 'woocommerce_cart_is_empty', 'popcorn_add_content_empty_cart' );
function popcorn_add_content_empty_cart() {
echo 'Voici un texte pour remplir le panier vide !';
}
<?php
add_filter( 'woocommerce_cart_subtotal', 'bbloomer_slash_cart_subtotal_if_discount', 99, 3 );
function bbloomer_slash_cart_subtotal_if_discount( $cart_subtotal, $compound, $obj ){
global $woocommerce;
if ( $woocommerce->cart->get_cart_discount_total() <> 0 ) {
$new_cart_subtotal = wc_price( WC()->cart->subtotal - $woocommerce->cart->get_cart_discount_tax_total() - $woocommerce->cart->get_cart_discount_total() );
$cart_subtotal = sprintf( '<del>%s</del> <b>%s</b>', $cart_subtotal , $new_cart_subtotal );
}