jamesjohnsonw
Forum Replies Created
-
I have fixed this.
- This reply was modified 1 year, 2 months ago by jamesjohnsonw.
Thank @bruceallen !
/JJ
Thank you, @bruceallen – I assume that if I start a new site and relink Jetpack, it will start monitoring the sites again?
Looks like I can’t redact/edit the reply above. Nevermind.
Thanks, /JJ
@bruceallen oh! I see – I tried to deactivate on my JetPack account but couldn’t find it!
creativejj.co
creatorcabin.co
johnsonfx.co.uk
kickspace.co
hustlerunners.co / hustlerunners.com
pentree.co.uk
climbnationstore.comThanks 🙂 Let me know once done so I can redact the domains.
- This reply was modified 3 years, 6 months ago by jamesjohnsonw.
Hi @bruceallen ,
There are no sites on the domains. So, no sites to access and nothing to see. I’ve completely removed all my sites from GoDaddy and moved hosting providers.
Hopefully, I shouldn’t have an issue going forward.
Thanks,
/JamesThanks @maykato
We’ve worked on the solution and created a new script that is cleaner and implements functionality for the registration form too! I’ve put the script below and you can see the full working here: https://stackoverflow.com/questions/69213708/redirecting-after-login-and-registration-only-if-coming-from-a-product-page
// Hide Add to Cart for logged out users add_action( 'init', 'creatorcabin_hide_price_add_cart_not_logged_in' ); function creatorcabin_hide_price_add_cart_not_logged_in() { if ( ! is_user_logged_in() ) { remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); } } // Add Login to Buy button for logged out users add_action( 'woocommerce_single_product_summary', 'creatorcabin_user_logged_out_disable_add_to_cart', 30 ); function creatorcabin_user_logged_out_disable_add_to_cart() { if ( ! is_user_logged_in() ) { $parameter = (is_singular("product")) ? '?product_page=1&my_page_id=' . get_the_ID() : ''; echo '<div class="login-to-buy-box"><h4 style="color: #E67E22;">Login to buy!</h4><p style="color: black;">Login or Sign Up for free to unlock the buy button and gain access to your downloads! <a href="/learn/using-our-website/why-do-i-need-an-account-to-buy-stuff/" target="_blank><p style="font-style: italic;">Why do I need an account to buy stuff?</p></a><a href="/my-account' . $parameter . '"><div class="user-bought-singleproduct">Login / Register ></div></a></div>'; } } // Referer add_action( 'woocommerce_login_form_end', 'creatorcabin_actual_referer' ); function creatorcabin_actual_referer() { $product_page = (isset($_GET['product_page'])) ? $_GET['product_page'] : 0; $page_id = (isset($_GET['my_page_id'])) ? $_GET['my_page_id'] : 0; echo '<input type="hidden" name="product_page" value="' . $product_page . '" /><input type="hidden" name="my_page_id" value="' . $page_id . '" />'; } //Login redirect function custom_login_redirect($redirect) { if (isset($_POST['my_page_id']) && isset($_POST['product_page']) && intval($_POST['product_page']) === 1) { $redirect = get_permalink($_POST['my_page_id']); } return $redirect; } add_filter('woocommerce_login_redirect', 'custom_login_redirect', 10, 1); // Action and Filter for Registration form add_action( 'woocommerce_register_form_end', 'creatorcabin_actual_referer' ); add_filter('woocommerce_registration_redirect', 'custom_login_redirect', 10, 1);/JJ
Hi @maykato ,
No problem. Solution can be found here: https://stackoverflow.com/questions/69213708/redirecting-after-login-and-registration-only-if-coming-from-a-product-page
/JJ
Hey @rainfallnixfig
Thanks for the reply! I appreciate you keeping the thread open. The following PHP script works correctly – it redirects the user back to the previous page after a successful login:
add_action( 'woocommerce_login_form_end', 'creatorcabin_actual_referrer' ); function creatorcabin_actual_referrer() { if ( ! wc_get_raw_referer() ) return; echo '<input type="hidden" name="redirect" value="' . wp_validate_redirect( wc_get_raw_referer(), wc_get_page_permalink( 'myaccount' ) ) . '" />'; }I tried adding the
woocommerce_login_redirecthook, as @stuartduff suggested but, it broke my script! 🙁I understand what I need may need custom work, I’m more than happy to look into it myself – I was just wondering if there was a hook or script line that is known to only activate a script (in this case the redirect) only if a user has come from a specific page or URL (in this case, a product page (domain.com/product/productname))?
Also, is there a hook that redirects a user after a successful WooCommerce registration?
If not, I can work on writing a custom script!
Thanks again,
/JJ- This reply was modified 4 years, 8 months ago by jamesjohnsonw.
- This reply was modified 4 years, 8 months ago by jamesjohnsonw.
Hey @stuartduff
Thanks for the tip! Do you know of a way of running PHP scripts only if a user is on a product page or, the previous page was a product page?
Thanks, /JJ
Forum: Plugins
In reply to: [WPC Product Bundles for WooCommerce] Creating Exclusive ProductsThanks, @miemie
On top of this fix, you can use the following code to make the exclusive product price read FREE instead of £0.
add_filter( 'woocommerce_get_price_html', 'bbloomer_price_free_zero_empty', 9999, 2 ); function bbloomer_price_free_zero_empty( $price, $product ){ if ( '' === $product->get_price() || 0 == $product->get_price() ) { $price = '<span class="woocommerce-Price-amount amount">FREE</span>'; } return $price; }More information on the Exclusive Products code. In this example, I have created a category called ‘Bundle Exclusives’ which has the slug name ‘bundle-exclusives’. Any exclusive products need to be added to this category (which is hidden) and set to ‘Shop Only’ visibility. The product will be hidden but still purchasable through a bundle.
Here is the exclusive products code once again for reference
// DISABLE PURCHASE add_filter( 'woocommerce_add_to_cart_validation', 'woosb_prevent_exclusive_products', 10, 2 ); function woosb_prevent_exclusive_products( $passed, $product_id ) { $exclusive_products = array( 6292, 6291, 6290, 6286, 6285, 6284, 6279, 6278, 6277 ); // fill your exclusive products ID here if ( in_array( $product_id, $exclusive_products, false ) ) { wc_add_notice( esc_html__( 'This is an exclusive product only available in bundles!', 'woo-product-bundle' ), 'error' ); return false; } return $passed; } // DISABLE ADD TO CART BUTTON, PRICE, SOCIAL SHARE AND CATEGORY LIST ON BUNDLE EXCLUSIVE CATEGORY add_action('woocommerce_single_product_summary', 'remove_product_description_add_cart_button', 1 ); function remove_product_description_add_cart_button() { // function for deleting ... // Set category ID $categories = array('bundle-exclusives'); //Feature removal if ( has_term( $categories, 'product_cat', get_the_id() ) ) { remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 ); } } // HIDE BUNDLE EXCLUSIVE CATEGORY add_filter( 'get_terms', 'ts_get_subcategory_terms', 10, 3 ); function ts_get_subcategory_terms( $terms, $taxonomies, $args ) { $new_terms = array(); if ( in_array( 'product_cat', $taxonomies ) && ! is_admin() &&is_shop() ) { foreach( $terms as $key => $term ) { if ( !in_array( $term->slug, array( 'bundle-exclusives', 'uncategorized' ) ) ) { //pass the slug name here $new_terms[] = $term; }} $terms = $new_terms; } return $terms; } // HIDE CATEGORY PRODUCTS FROM SHOP function custom_pre_get_posts_query( $q ) { $tax_query = (array) $q->get( 'tax_query' ); $tax_query[] = array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => array( 'bundle-exclusives' ), // Don't display products in the bundle-exclusives category on the shop page. 'operator' => 'NOT IN' ); $q->set( 'tax_query', $tax_query ); } add_action( 'woocommerce_product_query', 'custom_pre_get_posts_query' );You can see what this might look like here: https://prnt.sc/1hlwpt5 Outlined in red is our exclusive product that is only available in this bundle.
/JJ
Forum: Plugins
In reply to: [WPC Product Bundles for WooCommerce] Creating Exclusive ProductsResolved
If you are looking to create exclusive products you can use the following code to create hidden products which are purchasable through bundles:
// DISABLE PURCHASE add_filter( 'woocommerce_add_to_cart_validation', 'woosb_prevent_exclusive_products', 10, 2 ); function woosb_prevent_exclusive_products( $passed, $product_id ) { $exclusive_products = array( 6292, 6291, 6290, 6286, 6285, 6284, 6279, 6278, 6277 ); // fill your exclusive products ID here if ( in_array( $product_id, $exclusive_products, false ) ) { wc_add_notice( esc_html__( 'This is an exclusive product only available in bundles!', 'woo-product-bundle' ), 'error' ); return false; } return $passed; } // DISABLE ADD TO CART BUTTON, PRICE, SOCIAL SHARE AND CATEGORY LIST ON BUNDLE EXCLUSIVE CATEGORY add_action('woocommerce_single_product_summary', 'remove_product_description_add_cart_button', 1 ); function remove_product_description_add_cart_button() { // function for deleting ... // Set category ID $categories = array('bundle-exclusives'); //Feature removal if ( has_term( $categories, 'product_cat', get_the_id() ) ) { remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 ); } } // HIDE BUNDLE EXCLUSIVE CATEGORY add_filter( 'get_terms', 'ts_get_subcategory_terms', 10, 3 ); function ts_get_subcategory_terms( $terms, $taxonomies, $args ) { $new_terms = array(); if ( in_array( 'product_cat', $taxonomies ) && ! is_admin() &&is_shop() ) { foreach( $terms as $key => $term ) { if ( !in_array( $term->slug, array( 'bundle-exclusives', 'uncategorized' ) ) ) { //pass the slug name here $new_terms[] = $term; }} $terms = $new_terms; } return $terms; } // HIDE CATEGORY PRODUCTS FROM SHOP function custom_pre_get_posts_query( $q ) { $tax_query = (array) $q->get( 'tax_query' ); $tax_query[] = array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => array( 'bundle-exclusives' ), // Don't display products in the bundle-exclusives category on the shop page. 'operator' => 'NOT IN' ); $q->set( 'tax_query', $tax_query ); } add_action( 'woocommerce_product_query', 'custom_pre_get_posts_query' );Forum: Plugins
In reply to: [WPC Product Bundles for WooCommerce] Sale badge not appearing on BundlesTicket moved to Ticksy.
I’ll reply with resolution here.
Forum: Plugins
In reply to: [WPC Product Bundles for WooCommerce] Creating Exclusive ProductsTicket moved to WooCommerce.
I’ll reply with resolution here.
Ticket moved to Ticksy.
I’ll reply with resolution here.