Skip to content

Instantly share code, notes, and snippets.

View zimoo354's full-sized avatar

Charlie Ruiz zimoo354

View GitHub Profile
@jamesckemp
jamesckemp / woo-loop-custom-text.php
Last active November 29, 2017 01:28
Add some custom text (from an ACF field) to the product loop
<?php
/*
* Add this code to your functions.php file
*/
add_action( 'woocommerce_after_shop_loop_item_title', 'jck_custom_text', 15 );
function jck_custom_text() {
the_field('your_field_key');
<?php
// Add to cart checkout redirect
function custom_add_to_cart_redirect() {
$checkout_ = get_permalink( get_option( 'woocommerce_checkout_page_id' ) );
return $checkout_
}
add_filter( 'woocommerce_add_to_cart_redirect', 'custom_add_to_cart_redirect' );
@jamesckemp
jamesckemp / example.php
Created November 17, 2017 13:02
Enable custom field for specific products
<?php
/**
* Output engraving field.
*/
function iconic_output_engraving_field() {
global $product;
if ( $product->get_id() !== 1741 ) {
return;
}