This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Ne plus rendre le champ "Téléphone" obligatoire sur la page Commande de WooCommerce | |
*/ | |
function msk_wc_make_phone_field_not_required($address_fields, $country) { | |
$address_fields['billing_phone']['required'] = false; | |
return $address_fields; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Changer le logo PayPal afficher sur la page Commande du tunnel d'achat WooCommerce | |
* Ici, on affiche l'image nouveau-paypal-logo.png stockée dans le dossier /images/ du thème WordPress en cours d'utilisation | |
*/ | |
function msk_change_paypal_logo() { | |
return get_template_directory_uri() . '/images/nouveau-paypal-logo.png'; | |
} | |
add_filter('woocommerce_paypal_icon', 'msk_change_paypal_logo'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Cacher/supprimer le champ "Notes" sur la page Commande de WooCommerce | |
*/ | |
add_filter('woocommerce_enable_order_notes_field', '__return_false'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Affiche le code postal et la ville sur 2 colonnes | |
* Exemple : http://media.mosaika.fr/mbyK | |
*/ | |
function msk_display_zip_city_in_columns($fields) { | |
$fields['postcode']['class'] = array('address-field', 'form-row-first'); | |
$fields['city']['class'] = array('address-field', 'form-row-last'); | |
return $fields; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Ajouter un onglet 'Nouvel onglet' dans les onglets WooCommerce sur la page produit | |
* Tutoriel complet : https://mosaika.fr/woocommerce-ajouter-onglet-page-produit/ | |
*/ | |
function msk_woocommerce_new_tab($tabs) { | |
global $product; | |
$tabs['nouvel_onglet'] = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Séparation des décimales des prix WooCommerce : remplacer la virgule par un point | |
*/ | |
function msk_wc_price_args($args) { | |
$args['decimal_separator'] = ','; | |
return $args; | |
} | |
add_filter('wc_price_args', 'msk_wc_price_args'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Ajouter un champ "Code-barre" aux produits WooCommerce | |
* Ce nouveau champ s'affichera, ici, dans l'onglet "Inventaire" dans le back-office d'un produit WooCommerce | |
*/ | |
function msk_add_barcode_product_fields() { ?> | |
<div class="options_group"> | |
<?php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Afficher la description d'un code promo | |
* Illustré sur http://media.mosaika.fr/mcbj | |
*/ | |
function msk_display_coupon_description($value, $coupon) { | |
$new_value = sprintf('%1$s <small class="coupon-description">%2$s</small>', $value, $coupon->get_description()); | |
return $new_value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function msk_display_use_points_checkbox() { | |
// On récupère le nombre de points de l'utilisateur | |
$user_points = msk_get_customer_commission_balance(get_current_user_id())['balance']; | |
// Si l'acheteur a des points... | |
if ($user_points > 0) { | |
if (isset($_POST['post_data'])) { | |
parse_str($_POST['post_data'], $form_data); |