This file contains hidden or 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
jQuery( document ).ready(function($){ | |
$sync = $('.sync-stock-select'); | |
$sync.select2({ | |
minimumInputLength:1, | |
placeholder: 'Chercher un produit…', | |
ajax: { | |
url: '/wp-json/wp/v2/product', | |
dataType: 'json', | |
method:'GET', | |
delay: 250, |
This file contains hidden or 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 | |
add_filter( 'woocommerce_get_settings_products', 'woo_settings_free_products' ); | |
function woo_settings_free_products( $settings ) { | |
$settings[] = array( | |
'name' => __( 'Produits gratuits', 'woocommerce' ), | |
'type' => 'title', | |
'id' => 'free_products' | |
); | |
$settings[] = array( |
This file contains hidden or 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 | |
add_action( 'woocommerce_after_shop_loop_item', 'custom_add_to_cart' ); | |
function custom_add_to_cart() { | |
global $product; | |
vprintf( '<div class="add-to-cart-block"> | |
<div class="add-to-cart-block__price">%s</div> | |
<hr/> | |
%s | |
</div>', |
This file contains hidden or 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 | |
add_action( 'admin_menu', 'register_option_page', 10 ); | |
function register_option_page() { | |
if( function_exists( 'acf_add_options_page' ) ) { | |
acf_add_options_page( array( | |
'page_title' => 'Réglages des emails', | |
'menu_title' => 'Réglages', | |
'menu_slug' => 'emails-settings', | |
'capability' => 'manage_options', | |
'redirect' => false, |
This file contains hidden or 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 | |
// On tri par par ordre des termes dans la tax_query | |
add_action( 'pre_get_posts', 'w_filter_query' ); | |
function w_filter_query( $q ) { | |
if ( ! is_admin() && 'product' == $q->get('post_type') && is_post_type_archive( 'product' ) ) { | |
$q->set( 'need_special_order', 'tq_order' ); | |
} | |
} | |
add_filter('posts_orderby', 'edit_posts_orderby', 100, 2); |
This file contains hidden or 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 | |
require_once ABSPATH . 'wp-includes/class-wp-image-editor.php'; | |
require_once ABSPATH . 'wp-includes/class-wp-image-editor-imagick.php'; | |
final class ExtendedWpImageEditorImagick extends \WP_Image_Editor_Imagick | |
{ | |
protected function pdf_load_source() | |
{ | |
$loaded = parent::pdf_load_source(); |
This file contains hidden or 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 | |
add_action( 'woocommerce_review_order_after_shipping', 'shipping_warranty_cb' ); | |
function shipping_warranty_cb() { | |
?><tr class="shipping-fee"> | |
<th><?php _e( 'Assurance Expédition' ); ?></th> | |
<td><?php | |
woocommerce_form_field( 'shipping_warranty', array( | |
'type' => 'checkbox', | |
'class' => array('checkbox_field'), |
This file contains hidden or 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 | |
add_action( 'woocommerce_coupon_options', 'w_coupons_options', 10, 2 ); | |
function w_coupons_options( $id, $coupon ) { | |
woocommerce_wp_checkbox( | |
array( | |
'id' => 'auto_applied', | |
'label' => __( 'Activé automatiquement', 'woocommerce' ), | |
'description' => 'Cocher cette case pour ajouter automatiquement le coupon s’il est disponible pour le panier', | |
'value' => wc_bool_to_string( get_post_meta( $id, 'auto_applied', true ) ), |
This file contains hidden or 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 | |
add_action( 'admin_post_cart_to_quote', 'do_cart_to_quote' ); | |
add_action( 'admin_post_nopriv_cart_to_quote', 'do_cart_to_quote' ); | |
function w_cart_to_quote() { | |
$inst = YITH_Request_Quote::get_instance(); | |
foreach( WC()->cart->get_cart() as $k => $data ) { | |
$product_id = $data['product_id']; | |
$obj = array( | |
'context' => 'frontend', |
This file contains hidden or 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 PAS OUBLIER DE SUPPRIMER CE FICHIER */ | |
require_once( 'wp-load.php' ); | |
require_once( './wp-admin/includes/user.php' ); | |
if ( is_multisite() && function_exists('get_super_admins') && $admins = get_super_admins() ) { | |
$user = get_user_by( 'login', $admins[0] ); | |
$user_id = $user->ID; | |
} else { | |
$admins = get_users( array( 'role' => 'administrator' ) ); |
NewerOlder