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
add_filter( 'woocommerce_cart_shipping_packages', 'bulky_woocommerce_cart_shipping_packages' ); | |
function bulky_woocommerce_cart_shipping_packages( $packages ) { | |
// Reset the packages | |
$packages = array(); | |
// Bulky items | |
$bulky_items = array(); | |
$regular_items = 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
add_action( 'admin_head-post-new.php', 'woo_limit_products_creation' ); | |
function woo_limit_products_creation() { | |
global $post_type; | |
global $wpdb; | |
$products_limit = 50; // Change this value | |
if( $post_type === 'product' ) { |
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 | |
/* | |
* Create order dynamically | |
*/ | |
add_action( 'woocommerce_before_checkout_form', 'create_order' ); | |
function create_order() { | |
global $woocommerce; | |
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 | |
// Add Variation Settings | |
add_action( 'woocommerce_product_after_variable_attributes', 'variation_settings_fields', 10, 3 ); | |
// Save Variation Settings | |
add_action( 'woocommerce_save_product_variation', 'save_variation_settings_fields', 10, 2 ); | |
/** | |
* Create new fields for variations |
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 | |
/** | |
* Plugin Name: Restrict Orders per Day for WooCommerce | |
* Plugin URI: https://remicorson.com | |
* Description: Put the shop into catalogue mode once number of orders per day is reached. | |
* Version: 0.1 | |
* Author: Remi Corson, corsonr | |
* Author URI: https://remicorson.com | |
* License: GPL v2 or later | |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
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 | |
$count = 1; | |
foreach( $order->get_items() as $item_id => $line_item ){ | |
$item_data = $line_item->get_data(); | |
$product = $line_item->get_product(); | |
$product_name = $product->get_name(); | |
$item_quantity = $line_item->get_quantity(); | |
$item_total = $line_item->get_total(); | |
$metadata['Line Item '.$count] = 'Product name: '.$product_name.' | Quantity: '.$item_quantity.' | Item total: '. number_format( $item_total, 2 ); |
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
/* French initialisation for the jQuery UI date picker plugin. */ | |
/* Written by Keith Wood (kbwood{at}iinet.com.au) and Stéphane Nahmani (sholby@sholby.net). */ | |
jQuery(function($){ | |
$.datepicker.regional['fr'] = { | |
closeText: 'Fermer', | |
prevText: '<Préc', | |
nextText: 'Suiv>', | |
currentText: 'Aujourd\'hui', | |
monthNames: ['Janvier','Fevrier','Mars','Avril','Mai','Juin', | |
'Juillet','Aout','Septembre','Octobre','Novembre','Decembre'], |
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 | |
/* ------------------------------------------------------------------*/ | |
/* SECURE EMAIL SHORTCODE */ | |
/* ------------------------------------------------------------------*/ | |
function xxx_secure_mail( $atts ) { | |
extract( | |
shortcode_atts( array( | |
"mailto" => '', | |
"txt" => '' |
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 | |
// Set the endpoint and request method | |
$endpoint = '/wp/v2/posts'; | |
$method = 'POST'; | |
// Set the request body data | |
$body = array( | |
'title' => 'My new post', | |
'content' => 'This is the content of my new post.', |
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 | |
/* | |
* Display discounted products prices in the cart table. | |
* | |
* Modification of code provided here https://businessbloomer.com/woocommerce-display-cart-item-subtotal-coupon-discount/. | |
*/ | |
add_filter( 'woocommerce_cart_item_subtotal', 'if_coupon_slash_item_subtotal', 99, 3 ); | |
add_filter( 'woocommerce_cart_item_price', 'if_coupon_slash_item_subtotal', 99, 3 ); | |
/** |
NewerOlder