Forum Replies Created

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter bobezac

    (@bobezac)

    I was not able to test adp_before_apply_rule because I think that would require me to have more complex knowledge of how ADP’s rules are structured in PHP, and I lack the time to reverse engineer that, my rules are thousands of simple bulk quantity discounts, then I have my own database with specific user ID prices in, that I want to lookup and apply different prices that over-ride the bulk discounts, my functions are rather long and complex to get the prices, cache them etc, but I was able to get the desired output using this function

    add_filter( "wdp_custom_override_cents", function ( $custom_price, $price, $context, $product ) {
    	
    	$user_price = lookup_customer_price($product);
    	
    	if ($user_price !== null){
    		$custom_price = $user_price;
    		return $custom_price;
    	}
    	
    }, 10, 4 );

    can you think of a more efficient way to do it? my lookup price function will return null if user is not logged in or is not in the list etc

    Thread Starter bobezac

    (@bobezac)

    Do you want to modify prices for cart items after our rules were applied ?

    Yes, so I’d like the rules to apply as normal, but for specific customers I want to apply my own custom pricing list, but I’m not sure at what point I can hook the cart process to do this and make sure it applies to the actual order processing and not just visually

    Thread Starter bobezac

    (@bobezac)

    add_filter( "wdp_custom_override_cents", function ( $custom_price, $price, $context, $product ) {
    	
    	//set custom price
    	
    	return $custom_price;
    	
    }, 10, 4 );

    I’ve been able to use this hook as a workaround, open to a more efficient better hook to use if anyone has a suggestion!

    Thread Starter bobezac

    (@bobezac)

    @kaggdesign

    Something is definitely not right with the HPOS compatibility, I’m doing a completely fresh site and I’m seeing this warning mesage after installing hcaptcha after enabling HPOS earlier

    Thread Starter bobezac

    (@bobezac)

    Thanks @kaggdesign

    I just checked and the issue isn’t there on a fresh install, but my main site is running updated versions of woocommerce and hCaptcha, but it’s showing on the incompatibility list, so it must be something to do with the progressive update of one of them causing it, I’ll try re-installing hcaptcha and see if it fixes it.

    Thread Starter bobezac

    (@bobezac)

    Hi, one more question, I believe product only rules have a cache that needs to be regenerated? is there a way to call this cache update from php?

    Thread Starter bobezac

    (@bobezac)

    I think I’ve figured it out by reading what the importer is doing, this seems to work:

    use ADP\BaseVersion\Includes\ImportExport\Importer;
    function test_function_shortcode() {
    	$data = 'the json from exporter';
    	$data = json_decode(str_replace('\\', '', wp_unslash($data)), true);
    	return var_dump(Importer::importRules($data, true));
    }
    Thread Starter bobezac

    (@bobezac)

    Hi, thanks that works to call the function correctly, however I can’t get it to import the rules from the JSON, the JSON I’m parsing works in the “import tool” if I paste it in there, but not when I call it myself in PHP, any ideas what I’m doing wrong, does the json need to be decoded before being parsed in any way?

    use ADP\BaseVersion\Includes\ImportExport\Importer;
    function test_function_shortcode() {
    	$data = 'the json from exporter';
    	return var_dump(Importer::importRules($data, true));
    }
    Thread Starter bobezac

    (@bobezac)

    @stuygoy27,

    I downloaded the source to check, the above begins on line 361 of “woo-fly-cart\assets\js\frontend.js” if you want to have a look, but there were a lot of other issues I was having with this cart which made me change, so I’m not sure if just the above is enough to make it work perfect.

    Kind Regards,
    Bobez

    Thread Starter bobezac

    (@bobezac)

    Hi @stuygoy27,

    I actually stopped using this plugin so I can’t check, but from memory it should be located in one of the included javascript asset files.

    If you want a similar plugin thats up to date, I recommend “XT Floating Cart for WooCommerce” although it is paid for a lot of the useful settings unless you know your way around PHP.

    Kind Regards,
    Bobez

    Thread Starter bobezac

    (@bobezac)

    Issue appears to be related to ajax not returning correctly

    I’ve managed to temporarily fix it by adding the loading clear at the end here:

    
    function woofc_update_qty(cart_item_key, cart_item_qty) {
      woofc_cart_loading();
    
      var data = {
        action: 'woofc_update_qty',
        cart_item_key: cart_item_key,
        cart_item_qty: cart_item_qty,
        security: woofc_vars.nonce,
      };
    
      jQuery.post(woofc_vars.ajaxurl, data, function(response) {
        woofc_cart_reload();
    
        jQuery(document.body).
            trigger('woofc_update_qty', [cart_item_key, cart_item_qty]);
      });
    }
    
    function woofc_update_qty(cart_item_key, cart_item_qty) {
      woofc_cart_loading();
    
      var data = {
        action: 'woofc_update_qty',
        cart_item_key: cart_item_key,
        cart_item_qty: cart_item_qty,
        security: woofc_vars.nonce,
      };
    	
      jQuery.post(woofc_vars.ajaxurl, data, function(response) {
        woofc_cart_reload();
    
        jQuery(document.body).trigger('woofc_update_qty', [cart_item_key, cart_item_qty]);
    	  
    	  woofc_cart_loaded();
    	  
      });
    }
    

    Thanks @qtwrk, I didn’t know elementor was breaking the shortcodes even on non-elementor pages :O

    Using the latest dev branch fixes it for me!

    Just out of interest, that php sammple hellogerowsky linked is completely outdated right? any chance you can get someone to put a warning message that the below code is out of date and no longer works or something with the new doc link at the top of that page? it’s plastered all over google search results and I spent hours trying to use that sample until I saw a post from you in another support thread that you now use applyfilters and not the class directly.

    not meaning to hijack the thread, but as me and hellogerowsky have the same issue, maybe it’s the same cause and theres little point opening another thread right?, my report number:

    FLQUAKRT

    I’m having the exact same issue with shortcodes, widgets work, but not shortcodes, I just see the text when I put [esi at the start.

    I believe that guide is out of date, but I also tried the one here:

    https://docs.litespeedtech.com/lscache/lscwp/api/#generate-esi-block-url

    Still doesn’t work, just gives an error when trying to use it in a shortcode.

    I’m definitely using litespeed enterprise on cyberpanel, esi enabled in htaccess and everywhere I can find it in the webadmin console, still nothing.

Viewing 14 replies - 1 through 14 (of 14 total)