Skip to content

Instantly share code, notes, and snippets.

View j2machado's full-sized avatar
💻
Creating Cool Stuff

Juan José Machado j2machado

💻
Creating Cool Stuff
View GitHub Profile
@j2machado
j2machado / ld-bypass-linear-progression-for-courses.php
Last active July 18, 2025 15:13
LearnDash LMS - Bypass the linear progression for courses.
<?php
/**
* Bypass the linear progression for courses in LearnDash LMS,
* leveraging the learndash_course_progression_enabled filter.
*
* @param bool $setting. The $setting value in the database. True for Linear Progression, False for Free Form.
* @param int $course_id. The course ID.
*
* @return bool.
*/
@j2machado
j2machado / functions.php
Last active July 17, 2025 17:30
LearnDash LMS - Change the Great Job! You've completed this lesson - Keep it going! message.
<?php
/**
* Change the Great Job! You've completed this %s - Keep it going!" message
* for any custom message of your choice using the learndash_alert_message filter.
*
* @param string $message. The message to be filtered.
* @param string $type. The type of message.
* @param string $icon. The message icon.
*
* @return string $message. The filtered message.
@j2machado
j2machado / ld-show-the-login-form-first-on-page-load.php
Last active May 5, 2025 13:35
Show the Login Form first in the LearnDash Registration form
<?php
/*
* Show the Login Form first on the Registration page.
*/
add_action( 'wp_footer', function () {
// Get the LearnDash registration page ID.
$ld_registration_page_id = learndash_registration_page_get_id();
// Exit if user is already logged in or not on the registration page.
@j2machado
j2machado / debug_learndash_quiz_certificates.php
Last active July 17, 2025 17:30
Debug LearnDash Quiz Certificates
<?php
/**
* Debug LearnDash Quiz Certificates.
*
* Enter the Quiz ID and User ID into the [debug_learndash_quiz_certificate] shortcode.
* If the user has earned the certificate for the quiz, the shortcode will return
* the Certificate Download link.
*
* Clicking the link should open the generated certificate PDF according to the
* certificate settings in the quiz.
@j2machado
j2machado / delivery-off-on-cart-total-25-or-less.php
Last active July 17, 2025 17:31
CheckoutWC Local Pickup - Disable Delivery (shipping) from the Delivery Method selection when the cart total is 25 or less.
<?php
/*
* Turn off Delivery (shipping option) in CheckoutWC's Local Pickup,
* if the WooCommerce cart total is less or equal than 25.
*
* @param bool $disable. Whether to disable Delivery or not.
* @return bool. The filtered value.
*/
add_filter( 'cfw_local_pickup_disable_shipping_option', function( $disable ) {
@j2machado
j2machado / hide-shipping-from-delivery-methods-basesd-on-product-category.php
Last active July 17, 2025 17:31
In CheckoutWC's Delivery method, hide the Shipping option completely when at least one product in the cart is assigned to a specific category.
<?php
/*
* In CheckoutWC's Delivery method, hide the Shipping option completely when at least
* one product in the cart is assigned to a specific category.
*
* @author Obi Juan <hola@obijuan.dev>
* @link https://obijuan.dev
*/
/*
@j2machado
j2machado / additional-css.css
Last active February 5, 2024 16:50
CSS Improvements for The Mass Apothecary
/*
* CSS Improvements for The Mass Apothecary.
*
* Improves the look and feel of the purchase options (Subscription + One Time payment)
* on the single product pages.
*
* @author Obi Juan <hola@obijuan.dev>
* @authorURI https://obijuan.dev/
* @license GPL v2 or later.
*
<?php
/*
* Snippet: 'Filter' the Dimensions label under the Additional Information tab on the Single Product page in WooCommerce.
* Author: Obi Juan.
* Author URI: https://obijuan.dev.
* License: GPL v2 or later.
*/
add_filter( 'woocommerce_display_product_attributes', 'obi_woocommerce_custom_dimensions_label', 10, 2 );
@j2machado
j2machado / functions.php
Created November 7, 2023 16:49
Add an icon to any individual shipping method in WooCommerce checkout page.
<?php
/*
* Compatible with CheckoutWC Lite and CheckoutWC premium version.
*
* Snippet: Add a custom icon to any shipping method one by one in WooCommerce.
* Full Explanation: Coming soon.
* Author: Obi Juan
* Author URI: https://obijuan.dev
* License: GPL V2 or later.
@j2machado
j2machado / functions.php
Created October 7, 2023 18:40
WooCommerce: Display the discounted amount per product on the Order Details table.
<?php
/*
* Snippet: Display the discounted amount per product on the Order Details in WooCommerce.
* Full Explanation: https://obijuan.dev/display-the-discounted-amount-per-product-on-the-order-details-in-woocommerce/.
* Author: Obi Juan
* Author URI: https://obijuan.dev
* License: GPL V2 or later.
*/