Skip to content

Instantly share code, notes, and snippets.

View reandimo's full-sized avatar
🎯
Focusing on creating things.

Renan Diaz reandimo

🎯
Focusing on creating things.
View GitHub Profile
@reandimo
reandimo / functions.php
Last active November 3, 2023 16:03
Skip Renewal action in My Account for Woocommerce Subscriptions (skip next month renewal)
<?php
add_filter('wcs_view_subscription_actions', 'add_skip_action', 99, 3);
add_filter('wcs_view_subscription_actions', 'rename_default_actions', 10, 3);
/**
* Adds the customer skip action, if allowed. Ex. If next renewal is in Oct 10, when the user click this button, the next payment date will be in Nov 10.
* Long story short, delays next payment date 1 month for the subscription.
*
* @since 4.0.0
@reandimo
reandimo / functions.php
Created November 3, 2023 14:18
Hide shipping rates when free shipping is available in Woocommerce's Checkout
<?php
add_filter('woocommerce_package_rates', 'maybe_force_free_shipping', 99);
/**
* @param array $rates Array of rates found for the package.
* @return array
*/
function maybe_force_free_shipping($rates)
{
@reandimo
reandimo / woo-events.js
Created September 29, 2023 16:35 — forked from bagerathan/woo-events.js
[Woocommerce Javascript events] #woo
//Woocommerce Checkout JS events
$( document.body ).trigger( 'init_checkout' );
$( document.body ).trigger( 'payment_method_selected' );
$( document.body ).trigger( 'update_checkout' );
$( document.body ).trigger( 'updated_checkout' );
$( document.body ).trigger( 'checkout_error' );
//Woocommerce cart page JS events
$( document.body ).trigger( 'wc_cart_emptied' );
$( document.body ).trigger( 'update_checkout' );
@reandimo
reandimo / apfs-regular-price-for-subscriptions-discounts.php
Last active May 19, 2022 20:20
Use regular price instead of sale price for calculating subscriptions discounts - All Products for WooCommerce Subscriptions
<?php
/**
* Plugin Name: All Products for WooCommerce Subscriptions - Use regular price instead of sale price for calculating subscriptions discounts
* Plugin URI: https://woocommerce.com/products/all-products-for-woocommerce-subscriptions/
* Description: Use this snippet to hide cart item subscription options for free products.
* Version: 1.0
* Author: Renan Diaz
* Author URI: https://nativo.team/
* Developer: Renan Diaz
@reandimo
reandimo / apfs-hide-free-cart-item-plan-options.php
Created April 26, 2022 20:56
Hide Cart Item Subscription Options for Free Products - All Products for WooCommerce Subscriptions
<?php
/**
* Plugin Name: All Products for WooCommerce Subscriptions - Hide Cart Item Subscription Options for Free Products
* Plugin URI: https://woocommerce.com/products/all-products-for-woocommerce-subscriptions/
* Description: Use this snippet to hide cart item subscription options for free products.
* Version: 1.0
* Author: Renan Diaz
* Author URI: https://nativo.team/
* Developer: Renan Diaz
*/
@reandimo
reandimo / woocommerce-send-email-using-default-template.php
Last active March 23, 2019 02:49
Woocommerce, wrap any content in the woocommerce default template of your store.
<?php
/**
* Wrap any content in the WooCommerce default email template of your store, for any use. Get the heading, message and footer to send.
* @author Renan Diaz <reandimo23@gmail.com>
*/
function wrap_email_content( $heading = null, $message = null ) {
if ( $message !== null && !empty($message) ) {
@reandimo
reandimo / booked-es_ES.po
Created May 5, 2018 14:58
Booked Spanish Tranlation
msgid ""
msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"Project-Id-Version: Booked Appointments\n"
"POT-Creation-Date: 2018-01-05 15:39-0500\n"
"PO-Revision-Date: 2018-05-05 14:54+0000\n"
"Last-Translator: Nativo Team <admin@nativoteam.com>\n"
"Language-Team: Spanish (Spain)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@reandimo
reandimo / restrinct-categories-combination.php
Last active May 19, 2021 16:09
Woocommerce Restrinct Certain Categories Combinations
<?php
//Renan Diaz - 2018
//Woocommerce restrinct certain categories combinations in the Woocommerce cart
//Restrinctions Begin
add_action('woocommerce_before_single_product', 'fs_check_category_in_cart');
function fs_check_category_in_cart() {
// Set $cat_in_cart
$cat_in_cart = '';