Use this to dynamically create and set the content of a Bootstrap 4 Modal.
In this example, we chose an onclick
handler to initialize the modal (only once), and then set the content of the modal dynamically.
<?php | |
/* | |
Plugin Name: WooCommerce disable product link in Order page | |
Plugin URI: https://www.damiencarbery.com/2021/05/disable-product-link-in-woocommerce-order-page/ | |
Description: Disable link to product in WooCommerce Order page (in My Account area). | |
Author: Damien Carbery | |
Version: 0.1 | |
*/ |
<?php | |
/* | |
Plugin Name: Attach files to WooCommerce order email | |
Plugin URI: https://www.damiencarbery.com/2021/05/attach-files-to-woocommerce-order-email/ | |
Description: Upload files to an order to attach them to the WooCommerce Order Completed email. | |
Author: Damien Carbery | |
Author URI: https://www.damiencarbery.com | |
Version: 0.9.20240612 | |
WC tested up to: 9.1.2 | |
Requires Plugins: woocommerce,cmb2 |
// Save the current language in post_meta when checkout is processed (used to identify correct Email language) | |
add_action('woocommerce_checkout_update_order_meta', 'dartrax_save_language_on_checkout', 10, 2 ); | |
function dartrax_save_language_on_checkout( $order_id, $posted ) { | |
if( ! class_exists('TRP_Translate_Press') ) return ''; | |
global $TRP_LANGUAGE; | |
update_post_meta( $order_id, 'order_language', $TRP_LANGUAGE ); | |
} | |
// Woocommerce Germanized Mails | |
add_action( 'woocommerce_gzd_shipment_status_draft_to_shipped_notification', 'dartrax_prepare_locale_for_Mail_with_shipment_id', 5, 1 ); |
// Save the current language in post_meta when checkout is processed (used to identify correct Email language) | |
add_action('woocommerce_checkout_update_order_meta', 'dartrax_save_language_on_checkout', 10, 2 ); | |
function dartrax_save_language_on_checkout( $order_id, $posted ) { | |
if( ! class_exists('TRP_Translate_Press') ) return ''; | |
global $TRP_LANGUAGE; | |
update_post_meta( $order_id, 'order_language', $TRP_LANGUAGE ); | |
} | |
// Woocommerce Shipment Mails | |
add_action( 'woocommerce_order_status_processing_to_cancelled_notification','dartrax_prepare_locale_for_Mail_with_order_id', 5, 1 ); |
<?php | |
/** | |
* Order details table shown in emails. | |
* | |
* This template can be overridden by copying it to yourtheme/woocommerce/emails/email-order-details.php. | |
* | |
* HOWEVER, on occasion WooCommerce will need to update template files and you | |
* (the theme developer) will need to copy the new files to your theme to | |
* maintain compatibility. We try to do this as little as possible, but it does | |
* happen. When this occurs the version of the template file will be bumped and |
<?php | |
/* | |
Plugin Name: Add capability to a specific user | |
Plugin URI: https://www.damiencarbery.com/2020/06/add-capability-to-a-specific-user/ | |
Description: Add 'manage_options' capability to an non-admin user. | |
Author: Damien Carbery | |
Author URI: https://www.damiencarbery.com | |
Version: 0.1 | |
*/ |
const MAX_WIDTH = process.env.PHOTO_MAX_WIDTH || 800; | |
const QUALITY = process.env.PHOTO_QUALITY || 0.9; | |
const readPhoto = async (photo) => { | |
const canvas = document.createElement('canvas'); | |
const img = document.createElement('img'); | |
// create img element from File object | |
img.src = await new Promise((resolve) => { | |
const reader = new FileReader(); |
<?php | |
/* | |
Plugin Name: Remove 'Add to cart' conditionally | |
Plugin URI: https://www.damiencarbery.com/2020/03/remove-add-to-cart-button-conditionally/ | |
Description: Conditionally remove the 'Add to cart' button in WooCommerce. | |
Author: Damien Carbery | |
Version: 0.4 | |
WC tested up to: 5.1.0 | |
*/ |
Use this to dynamically create and set the content of a Bootstrap 4 Modal.
In this example, we chose an onclick
handler to initialize the modal (only once), and then set the content of the modal dynamically.
//Hope you added spin.js and spin.css added in your html folder | |
// Custom spinner config | |
const customSpinner = { | |
custSpinUno: { | |
scale: 0.18, | |
color: '#d0d5db' | |
}, | |
custSpinDos: { | |
scale: 0.18, |