Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #3733289
Setting plugin priority within before add to cart button area
Open

Comments

  •  2
    Christina started the conversation

    I have a few different plugins to add options and details to products in the "before add to cart button" area and to get things to show in the order I'd like them to, I need to set the priority for a couple of them.  In the attached image I found the place in the product options files where this priority is set.....the highlighted line originally had 10 set for the priority, i changed it to 1, and now the order on my page is how I want it......  What I'm wondering is if someone could give me a snippet I can add to WPCode so this change won't potentially be lost when the plugin updates.  I am completely learning stuff as I go, so this is beyond my skill level and honestly I'm' surprised I even found the right thing to change in the first place 😅

    Attached files:  productoptions.png

  •  1,281
    Dustin replied

    Hi Christina,

    Please add the custom code below. (How to add custom code? ↗):

    remove_action( 'woocommerce_before_add_to_cart_button', [ Wpcpo_Frontend::instance(), 'display' ], 10 );
    add_action( 'woocommerce_before_add_to_cart_button', [ Wpcpo_Frontend::instance(), 'display' ], 1 );

    If it doesn't work, please try another one:

    add_action( 'init', function () {
    	remove_action( 'woocommerce_before_add_to_cart_button', [ Wpcpo_Frontend::instance(), 'display' ], 10 );
    	add_action( 'woocommerce_before_add_to_cart_button', [ Wpcpo_Frontend::instance(), 'display' ], 1 );
    } );

    Best regards,
    Dustin

  •  2
    Christina replied

    The first didn't work, but the second did!  Thank you!