Forum Replies Created

Viewing 15 replies - 1 through 15 (of 36 total)
  • Thread Starter hambos22

    (@hambos22)

    Yeah it’s resolved right now! Everything is mine. I’m building a plugin which adds minicart and wishlist functionality with Vue.js.

    Anyway one more question though if you know it. (maybe I should make a new topic for it?) Is there any chance, I could catch the errors (sold individually, no stock etc every case) for showing them as js dynamic notifications warnings/errors, without redirecting the user to the specific product and without making modifications to the core (and of course without setting all the conditionals :p )?

    Thread Starter hambos22

    (@hambos22)

    Hello! Thanks for your response!

    The ajaxAddAllToCart is triggered by js.

    Well I feel a little bit ashamed right now. You were right. Now its working flawlessly. I should put the wp_send_json_success right before the die(); I was bagging my head on the wall for hours.

    Thanks for noticing that!

    That did the job 🙂 Thank you

    Hello.

    A little bit late, but by saying slightly hacky you mean I must change the core files?

    If yes, Can I just disable this specific notice?

    I tried by adding a filter on woocommerce_login_redirect with a wc_add_notice but it just showing another one notice.

    function new_login_message_2422($redirect) {
         wc_add_notice('You have logged in', 'text-domain');
         return $redirect;
     }
    add_filter('woocommerce_login_redirect', 'new_login_message_2422', 10, 2);

    Thanks

    Thread Starter hambos22

    (@hambos22)

    I’m a little bit confused right now. I don’t want to use it at variation level but at product level. I just don’t want the users to be able to buy stuff if its instore only.

    Is it safe to just remove the add to cart button by removing its action? If its safe, I will not use the is_purchasable and I’ll use the remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );

    I tested this code and is not working.

    function availableOrNot()
    {
        global $product, $post;
        $field = get_field_object('availabilityInOut');
        $value = get_field('availabilityInOut');
    
        if ('instore' == $value || 'tba' == $value) {
    
            return false;
        }
        else{
          return true;
        }
    }
    
    add_filter('woocommerce_variation_is_purchasable', 'availableOrNot');
    Thread Starter hambos22

    (@hambos22)

    Hello Mike, thanks for your response. I tried that too, after digging the code and it’s not working. I put it on the code above

    Keep in mind that the second arg “hide_add_cart” is a function

    function hide_add_cart(){
    return false;
    }

    Yeah me too. Is there a way? I cant find anything to hook

    Thread Starter hambos22

    (@hambos22)

    Thanks for your fast answer and A+++ answer anyway.

    Kind regards 🙂

    Thread Starter hambos22

    (@hambos22)

    It works flawlessly. With custom fields I can store the converted sizes in the database for later use such as the receipt or order confirmation. So If someone buys something in EU size on the receipt and order confirmation it will show the US, UK and CM sizes too. Its not converting the values on the fly. With my method I can organize each brand size chart better and also my client will be able to add sizes himself. Now I must do something with the cookies to store the selection but that’s another thing.

    Here take a look on an attribute (screenshot)

    Thread Starter hambos22

    (@hambos22)

    Wow! Thank you for this awesome answer!

    Nike, Adidas and Puma have different sizes though, so Its a little more complicated :/ Btw I’m gonna use your snippet for sure!

    Anyway, I’ve managed to do it with the use of Advanced Custom Fields plugin. I’ve added 3 more custom fields in the Attribute -size- (UK, US, CM). So if I click in an attr then I can put some more info. Then I’ve added some data-attr for each region and with JS I’ve managed to do the switch but adding and removing classes for show/hide.

    Here is a php snippet

    $us_size = get_field('us_size', $term);
    	$uk_size = get_field('uk_size', $term);
    	$cm_size = get_field('cm_size', $term);
    	printf( '<div class="sizeRadio">
    		<input type="radio" name="%1$s" value="%2$s" id="%3$s" %4$s>
    		<label for="%3$s">
    		<span class="label_show" data-region="eu">%5$s</span>
    		<span data-region="us">%6$s</span>
    		<span data-region="uk">%7$s</span>
    		<span data-region="cm">%8$s</span>
    		</label>
    		</div>', $input_name, $esc_value, $id, $checked, $filtered_label, $us_size, $uk_size, $cm_size );
    }

    Here is a JS snippet

    $('[data-chooseregion]').on('click', function(e) {
                            $(this).addClass('active--sizeSelect').siblings().removeClass('active--sizeSelect');
    
                            var $active = $('[data-region=' + $(this).data('chooseregion') + ']').addClass('label_show');
    
                            $('[data-region]').not($active).removeClass('label_show');
                            e.preventDefault();
                        });

    Here is the markup for the switcher

    <?php
    	echo '<a class="sizeSelect active--sizeSelect" data-chooseregion="eu" href="#">EU</a>';
    	echo '<a class="sizeSelect" data-chooseregion="us" href="#" >US</a>';
    	echo '<a class="sizeSelect" data-chooseregion="uk" href="#" >UK</a>';
    	echo '<a class="sizeSelect" data-chooseregion="cm" href="#" >CM</a>';
    ?>

    Is it a good practice or not?

    Thanks again

    Thread Starter hambos22

    (@hambos22)

    UPDATE:

    Dumb problem :p

    The issue was that I had Codekit opened, and also the original MAMP address opened.

    “eshop.dev” and “bounjour address:5757” with different logins on each one. The bounjour one had the problem with redirections.

    Thread Starter hambos22

    (@hambos22)

    Hello Caleb, thanks for your response.

    Well I disabled all the plugins, and I switched to the original storefront theme. (I’m using on a child theme). The problem still existed. Then I switched to twenty fourteen and again the same problem.

    With disabled all the plugins

    Thread Starter hambos22

    (@hambos22)

    Thank you so much! it worked! i wanted that for very long time but i couldn’t find anything!

    Thank you again! 🙂

    Thread Starter hambos22

    (@hambos22)

    and how can i add the submenus? sorry if i’m too strenuous

    Thread Starter hambos22

    (@hambos22)

    i had also submenus.. how can i add them on your code?

Viewing 15 replies - 1 through 15 (of 36 total)