Publié le Laisser un commentaire

Visual Filter
Storefront WooCommerce

storefront_before_site

'Class->Storefront_Visual_Guide::display_filters() 1

Global Filters

Filter Description
storefront_make_me_cute Storefront Easter Egg.
storefront_custom_background_args Setup custom background color & image arguments. Overrides the storefront_default_background_color filter.
storefront_default_background_color Edits the background color in HEX format.
storefront_google_font_families Filters the default Google fonts. You need to change your CSS font-families.
storefront_menu_toggle_text Filters the text in the responsive menu toggle.
storefront_navigation_markup_template Filters the HTML markup of the navigation menu.
storefront_header_styles Filters the header styles with an array of all the inline css properties you want to change.
storefront_custom_logo_args Enables support for site logo, defining width, height, flex dimensions and header text.
storefront_register_nav_menus Changes the default registered navigation menus.
storefront_html5_args Switch default core markup to output valid HTML5.

storefront_before_header

'storefront_header_widget_region 10
'woocommerce_breadcrumb 10

storefront_content_top

'storefront_shop_messages 15

WooCommerce Filters

Filter Description
storefront_woocommerce_args Declare WooCommerce support and the default parameters.
storefront_customizer_woocommerce_extension_css Get extension css styles for Booking, Product Reviews & Smart Coupon addons.
storefront_loop_columns Filters the number of products per row
storefront_page_option_names Get WooCommerce page by ID.
storefront_product_thumbnail_columns Filters the product gallery thumbnail columns number.
storefront_products_per_page Filters the number of products per page in shop pages.
storefront_related_products_args Filters the related products number and colums arguments.
storefront_sticky_order_review Enqueue the Sticky Payment script in WooCommerce Checkout Add-Ons plugin.
storefront_upsells_columns Filters the number of columns of upsell products.
storefront_single_product_pagination_same_category Changes the option to only show products of the same category.
storefront_sticky_add_to_cart_params Filters the sticky Add to Cart parameters.

storefront_sidebar

'storefront_get_sidebar 10

storefront_before_footer

'Class->Storefront_Visual_Guide::widgets_filters() 10

Sidebar and Widgets Filters

Filter Description
storefront_footer_widget_rows Filters the number of footer widget rows.
storefront_footer_widget_columns Filters the number of footer widget columns.
storefront_sidebar_args Changes of default widget areas arguments (name, ID and description) for the sidebar, header and footer widget areas.

storefront_footer

'storefront_footer_widgets 10
 'Class->Storefront_Visual_Guide::footer_filters() 10 
'storefront_credit 20
'storefront_handheld_footer_bar 999

Footer Filters

Filter Description
storefront_copyright_text Modifies the Storefront footer copyright text.
storefront_credit_link Show or hide the Storefront credit link.
storefront_handheld_footer_bar_links Filters the handheld menu bar links.
storefront_copyright_text

storefront_after_footer

'storefront_sticky_single_add_to_cart 999
Publié le Laisser un commentaire

Visual Hook
Storefront WooCommerce

Storefront Theme > Header Hooks

storefront_before_site

storefront_before_header

storefront_header

add_action( 'storefront_header', 'storefront_header_container', 0 );
add_action( 'storefront_header', 'storefront_skip_links', 5 );
add_action( 'storefront_header', 'storefront_site_branding', 20 );
add_action( 'storefront_header', 'storefront_secondary_navigation', 30 );
add_action( 'storefront_header', 'storefront_product_search', 40 );
add_action( 'storefront_header', 'storefront_header_container_close', 41 );
add_action( 'storefront_header', 'storefront_primary_navigation_wrapper', 42 );
add_action( 'storefront_header', 'storefront_primary_navigation', 50 );
add_action( 'storefront_header', 'storefront_header_cart', 60 );
add_action( 'storefront_header', 'storefront_primary_navigation_wrapper_close', 68 );

Storefront Theme > Footer Hooks

storefront_before_footer

storefront_footer

add_action( 'storefront_footer', 'storefront_footer_widgets', 10 );
add_action( 'storefront_footer', 'storefront_credit', 20 );

storefront_after_footer

Storefront Theme > Sidebar Hooks

add_action( 'storefront_sidebar', 'storefront_get_sidebar', 10 );

Storefront Theme > Page Hooks

add_action( 'storefront_before_content', 'storefront_header_widget_region', 10 );
add_action( 'storefront_before_content', 'woocommerce_breadcrumb', 10 );
add_action( 'storefront_page', 'storefront_page_header', 10 );
add_action( 'storefront_page', 'storefront_page_content', 20 );
add_action( 'storefront_page_after', 'storefront_display_comments', 10 );

Storefront Theme > Page d’Accueil Template Hooks

storefront_before_content

add_action( ‘storefront_before_content’, ‘storefront_header_widget_region’, 10 );
add_action( ‘storefront_before_content’, ‘woocommerce_breadcrumb’, 10 );

homepage

add_action( 'homepage', 'storefront_homepage_content', 10 );
add_action( 'homepage', 'storefront_product_categories', 20 );
add_action( 'homepage', 'storefront_recent_products', 30 );
add_action( 'homepage', 'storefront_featured_products', 40 );
add_action( 'homepage', 'storefront_popular_products', 50 );
add_action( 'homepage', 'storefront_on_sale_products', 60 );
add_action( 'homepage', 'storefront_best_selling_products', 70 );

Accueil

Content of the WordPress page goes here.

storefront_homepage_before_product_categories

Categories de Produits

storefront_homepage_after_product_categories_title

storefront_homepage_after_product_categories

storefront_homepage_before_recent_products

Produits Recents

Storefront_homepage_after_recent_products_title

storefront_homepage_after_recent_products

storefront_homepage_before_featured_products

Produits à la Une

storefront_homepage_after_featured_products_title

storefront_homepage_after_featured_products

storefront_homepage_before_popular_products

Top Rated Products

storefront_homepage_after_popular_products_title

storefront_homepage_after_popular_products

storefront_homepage_before_on_sale_products

On Sale

storefront_homepage_after_on_sale_products_title

storefront_homepage_after_on_sale_products

storefront_homepage_before_best_selling_products

Best Sellers

storefront_homepage_after_best_selling_products_title

storefront_homepage_after_best_selling_products_products

Storefront Theme > Post Hooks

add_action( 'storefront_loop_post', 'storefront_post_header', 10 );
add_action( 'storefront_loop_post', 'storefront_post_meta', 20 );
add_action( 'storefront_loop_post', 'storefront_post_content', 30 );
add_action( 'storefront_loop_after', 'storefront_paging_nav', 10 );
add_action( 'storefront_single_post', 'storefront_post_header', 10 );
add_action( 'storefront_single_post', 'storefront_post_meta', 20 );
add_action( 'storefront_single_post', 'storefront_post_content', 30 );
add_action( 'storefront_single_post_bottom', 'storefront_post_nav', 10 );
add_action( 'storefront_single_post_bottom', 'storefront_display_comments', 20 );
add_action( 'storefront_post_content_before', 'storefront_post_thumbnail', 10 );
Publié le Laisser un commentaire

Créer un multisite avec WordPress Tutoriel WordPress

Modifier le fichier wp-config.php

define('WP_ALLOW_MULTISITE', true);
/* C’est tout, ne touchez pas à ce qui suit ! Bonne publication. */

Un nouveau element de menu apparait dans outil > Création du Réseau

Une nouvelle page s’affiche et vous demande de désactiver toutes vos extensions sur votre site.

Puis installer et une derniere page vous demande d’inserer du code dans wp-config et dans .htaccess

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'lisezmoi.fr');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
Créer un multisite avec WordPress Tutoriel WordPress

 

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
Publié le Laisser un commentaire

Ne permettre que l’achat d’une quantité de 1 pour un produit
Tutoriel Woocommerce

Vous pouvez bien sûr cocher la case vendu à l’unité dans l’onglet inventaire pour forcer l’achat de un seul produit.

Vendre individuellement Activer cette option pour n’autoriser qu’un exemplaire unique de cet article dans une commande

Vendre individuellement Activer cette option pour n’autoriser qu’un exemplaire unique de cet article dans une commande
Vendre individuellement Activer cette option pour n’autoriser qu’un exemplaire unique de cet article dans une commande

 

Mais si vous ne voulez pas le cocher pour chaque produit ou vous souhaiter que cela soit réalisé selon certaines conditions

Code Ne permettre que l’achat d’une quantité de 1 pour un produit  Tutoriel Woocommerce

Code : forcer “Vendre individuellement” quand le stock est bas

add_filter( 'woocommerce_is_sold_individually', 'product_max_1_cart_stock_low', 9999, 2 );

function product_max_1_cart_stock_low( $individually, $product ) {
if ( $product->get_stock_quantity() < 3 ) {
$individually = true;
}
return $individually;
}

Code : forcer “Vendre individuellement” selon un ACF

add_filter( 'woocommerce_is_sold_individually', 'product_max_1_cart_custom_field', 9999, 2 );

function product_max_1_cart_custom_field( $individually, $product ) {
$acf_field_value = get_field( 'acf_field_id', $product->get_id() );
if ( $acf_field_value && 'whatever' == $acf_field_value ) {
$individually = true;
}
return $individually;
}

 

Publié le Laisser un commentaire

Afficher des Offres ou Messages à partir d’une certaine Somme
Tutoriel Woocommerce

Activer les fonctionnalités WooCommerce uniquement si un utilisateur a dépensé plus de X

Par exemple, vous souhaiterez peut-être afficher des bannières, des offres spéciales, des prix réduits, du contenu conditionnel aux clients qui ont acheté plus qu’un seuil en euros donné.

Fonction WooCommerce ci-desssous  est utilisable comme balise conditionnelle et exécuter une fonction uniquement lorsque ce seuil est atteint

wc_get_customer_total_spent ($ user_id).

Code “Afficher une bannière si l’utilisateur dépasse une certaine somme”

add_action( 'woocommerce_before_cart', 'show_banner_if_user_spent_more_than' );

function show_banner_if_user_spent_more_than() {
$current_user = wp_get_current_user();
// si non loggé, sortir
if ( 0 == $current_user->ID ) return;
// si dépasse 99€
if ( wc_get_customer_total_spent( $current_user->ID ) > 99 ) {
echo '<div class="woocommerce-info">Vous avez gagné une promo !</div>';
}
}
Publié le Laisser un commentaire

Changer les Crédits & Copyright du Pied de Page
Tutoriel Storefront Woocommerce

Le contenu Crédits & Copyright est accessible par un hook donc il est possible de le modifier

Changer les Crédits & Copyright du Pied de Page Tutoriel Storefront Woocommerce
Changer les Crédits & Copyright du Pied de Page Tutoriel Storefront Woocommerce
Changer les Crédits & Copyright du Pied de Page <br /> Tutoriel Storefront Woocommerce
Changer les Crédits & Copyright du Pied de Page
Tutoriel Storefront Woocommerce

Enlever complètement Copyright (Credits) du Thème Storefront

add_action( 'wp', 'remove_storefront_credits' );

function remove_storefront_credits() {
remove_action( 'storefront_footer', 'storefront_credit', 20 );
}

Enlever le copyright “Construit avec Storefront & WooCommerce”

add_filter( 'storefront_credit_link', '__return_false' );

Enlever le Copyright et Politique de Confidentialités du Thème Storefront

add_filter( 'storefront_privacy_policy_link', '__return_false' );

Enlever le Lien Copyright + Politique de Confidentialités du Thème Storefront

add_filter( 'storefront_credit_links_output', '__return_empty_string' );

Enlever le © WordPress 2020 du Thème Storefront Woocommerce

add_filter( 'storefront_copyright_text', '__return_empty_string' );

Modifier le texte © WordPress 2020 du Thème Storefront Woocommerce

add_filter( 'storefront_copyright_text', 'edit_storefront_copyright_text' );

function edit_storefront_copyright_text() {
$text = 'Copyright ' . date( 'Y' ) . ' par LisezMoi';
return $text;
}