Skip to content

Instantly share code, notes, and snippets.

View jrick1229's full-sized avatar
☠️

Joey Ricketts jrick1229

☠️
  • VA
  • 14:45 (UTC -04:00)
View GitHub Profile
@jrick1229
jrick1229 / one-page-checkout-issue_506.css
Created April 4, 2023 13:30
Quick fix for: OPC_issue_506
<style type="text/css">
@media only screen and (min-width: 783px) {
.opc-pricing-table-product.product-item.cart:first-child,
.opc-pricing-table-product.product-item.cart:nth-child(2) {
max-width: 50%;
width: 50%;
min-height: 186px;
}
.opc-pricing-table-product.product-item.cart:nth-child(3) {
@jrick1229
jrick1229 / banner-color-change.css
Created March 30, 2023 19:41
Banner color change, hover change, text color change
<style type="text/css">
.banner-0-0-7.mutiny-banner {
background-color: rgb(255,255,0) !important;
}
.mutiny-button > .text-0-0-34 {
color: rgb(128,128,128) !important;
}
.mutiny-button:hover > .text-0-0-34 {
color: rgb(255,255,255) !important;
@jrick1229
jrick1229 / wcs_sign_fee_discount_with_recurring.php
Last active April 25, 2023 14:56
WooCommerce Subscriptions – reduce the sign-up fee by a set amount when a recurring amount discount is added to the cart
<?php
add_action( 'woocommerce_cart_calculate_fees','wcs_sign_fee_discount_with_recurring', 10, 1 );
function wcs_sign_fee_discount_with_recurring( $cart ) {
global $product;
// set 999 equal to the post ID of the subscription product
$product_id = '999';
$product = wc_get_product( $product_id );
@jrick1229
jrick1229 / subscription-totals-table.php
Last active March 9, 2023 14:40
WooCommerce Subscriptions – disable the ability to remove line items within subscriptions. This template override should be uploaded at: .../wp-content/themes/{your-theme}/woocommerce/myaccount/subscription-totals-table.php
<?php
/**
* OVERRIDE: Subscription details table
* Remove the 'x' option within subscriptions on the My Account page
*
* @author Prospress / @jrick1229
* @package WooCommerce_Subscription/Templates
* @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0
* @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0
*/
@jrick1229
jrick1229 / catalog_visibility.sql
Created November 3, 2022 18:17
WooCommerce – Output a list of post_ids in the wp_postmeta table that are hidden from the catalog.
SELECT * FROM `wp_postmeta` WHERE `meta_key` LIKE '_visibility' AND `meta_value` LIKE 'hidden'
@jrick1229
jrick1229 / wcpb_round_to_nearest_whole_number.php
Created October 18, 2022 19:00
Round product price to nearest whole number based on an array of product IDs.
<?php
add_filter( 'raw_woocommerce_price', 'wcpb_round_to_nearest_whole_number' );
function wcpb_round_to_nearest_whole_number( $price ){
global $post;
$post_ID = $post->ID;
$page_id = array('123','345','398','80');
@jrick1229
jrick1229 / wcs_updated_log.php
Last active September 30, 2022 16:38
WC Subscriptions – Create a log in WC > Status > Logs to log when a subscription has been updated.
<?php
add_action( 'wcs_webhook_subscription_updated', 'wcs_updated_log', 999, 1 );
function wcs_updated_log ( $subscription ){
$logger = wc_get_logger();
$logger->info( 'Subscription ID: ' . $subscription . ' was updated! -- ', array( 'source' => 'subscription-updates-2' ) );
}
@jrick1229
jrick1229 / wc_brands_add_brand_name.php
Created September 20, 2022 18:44
[WooCommerce Brands]: Add brand name to single product page
<?php
/*
* Increase `1` on line 7 to move position of brand name
*/
add_action( 'woocommerce_single_product_summary', 'wc_brands_add_brand_name', 1 );
function wc_brands_add_brand_name() {
global $product;
@jrick1229
jrick1229 / wcs_remove_bulk_actions.php
Created May 6, 2022 14:19
Remove bulk actions for 'Subscriptions' in WooCommerce Subscriptions
<?php
add_filter( 'woocommerce_subscription_bulk_actions', '__return_false', 99, 2);
@jrick1229
jrick1229 / wc_product_type_notice_cart.php
Last active May 4, 2022 14:58
Display a notice for each product in the cart (looped) showing it's set product name and type (support for: https://woocommerce.com/products/all-products-for-woocommerce-subscriptions/)
<?php
add_action( 'woocommerce_before_cart', 'wc_product_type_notice_cart' );
function wc_product_type_notice_cart() {
foreach ( WC()->cart->get_cart() as $item ) {
$product = wc_get_product( $item['product_id'] );
if( $product->get_type() == 'subscription'){
wc_print_notice( $product->get_name() . " is a SIMPLE-" . strtoupper($product->get_type()) . " product.", 'notice' );
} elseif( ! empty( $item[ 'wcsatt_data'][ 'active_subscription_scheme' ] ) ) {