Site logo

Archived topic

Custom hook problem

5 replies · Started by johnaps on March 22, 2020

Viewing posts 1–6 of 6

Hello!

I have used gp hooks to implement a back to shop button on cart page, because previously i disabled header and footer on cart page so it will be in "focus mode"...

Problem is that i have used the following code only for cart page in the woocommerce_before_calculate_totals

<button class="rbs">
	<a href="https://sofianos-orthopedika.gr/">Πίσω στο κατάστημα</a>
</button>

<style>
	.sfm-navicon-button.x.sf_label_default {
		display: none;
	}
	@media (max-width: 768px) {
		.rbs {
			 width: -webkit-fill-available;
		}
	}
	.rbs {
		box-shadow: 0 0 1px 0 rgba(0,0,0,.1);
    border: 1px solid #ddd;
    transition: all 0.1s ease-in;
    border-radius: 8px!important;
    box-sizing: border-box;
		margin-bottom: 1.25em;
	}
	.rbs a {
		color: #ffffff;
		font-size: 16px;
		font-weight: bold;
	}
</style>

and i have cleared cache and i get 2 buttons today for some reason (one where it should be up top, and one to bottom left which is weird...). This happened today, when i first implemented the hook the button was where it should be with and was just one in the entire page...
P.S. i have also used different hook positions after seeing the problem with no luck...

In the following image you will see the 2 buttons (green is the good one, red is the bad/weird one)

https://imgur.com/a/KtmlbWl

Hi there,

If you set the Hook Element to "Draft", do both buttons disappear?

If not, perhaps the other one is being added using a custom function or another Element?

They do disappear both if i make it draft

Hi there,

can you try this hook:

woocommerce_before_cart

And remove the Button element so this:

<button class="rbs">
   <a href="https://sofianos-orthopedika.gr/">Πίσω στο κατάστημα</a>
</button>

becomes:

<a class="rbs button" href="https://sofianos-orthopedika.gr/">Πίσω στο κατάστημα</a>

That did it David! Cant understand why though but you are awesome! Keep up the good work! Thank you!

You're welcome.

This archived topic is closed to new replies.