Skip to content

Instantly share code, notes, and snippets.

View jhimross's full-sized avatar

Jhimross Olinares jhimross

View GitHub Profile
@jhimross
jhimross / gist:04eea2301aaccc39b9f45d4d7c8a0b7d
Created January 27, 2022 04:49
FluxCheckout - Translate "Back to Cart"
// Translate 'Back to Cart'
function translate_strings ( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Back to Cart' : // change text
$translated_text = __( 'Bumalik sa Cart', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'translate_strings', 20, 3 );
@jhimross
jhimross / gist:a51cc486149ae3b99211e5d359806c3f
Created January 27, 2022 04:48
WooCommerce Attributes Swatches - Remove "From" in the pricing in Product Page
/**
* Remove "From %s" format of pricing.
*/
function iconic_was_remove_from() {
remove_filter( 'woocommerce_variable_price_html', array( 'Iconic_WAS_Fees', 'variable_price_html' ), 10, 2 );
}
add_action( 'init', 'iconic_was_remove_from' );
@jhimross
jhimross / gist:a824451cabb8f517218dbea890c609ff
Created January 27, 2022 04:47
Add Product Thumbnail Images in FluxCheckout
add_filter( 'woocommerce_cart_item_name', 'iconic_product_image_on_checkout', 10, 3 );
function iconic_product_image_on_checkout( $name, $cart_item, $cart_item_key ) {
/* Return if not checkout page */
if ( ! is_checkout() ) {
return $name;
}
/* Get product object */
@jhimross
jhimross / gist:4d5ea63301d2f63abef49044af06f4c2
Created January 27, 2022 04:45
Add Product SKU in WooCommerce Cart, Checkout, and Order Details
// First, let's write the function that returns a given product SKU
function iconic_return_sku( $product ) {
$sku = $product->get_sku();
if ( ! empty( $sku ) ) {
return '<p>SKU: ' . $sku . '</p>';
} else {
return '';
}
}
@jhimross
jhimross / gist:a832c3936ae942bce961b4639b157b68
Created January 27, 2022 04:41
Iconic Linked Variations - Force show out of stock Linked Variations
/**
* Iconic Linked Variations - Force show out of stock Linked Variations.
*
* @param array $product_data Product Data.
* @param int $product_id Product ID.
*
* @return array
*/
function iconic_lv_force_show_out_of_stock_products( $product_data, $product_id ) {
foreach ( $product_data['attributes'] as &$attribute ) {