- This topic has 11 replies, 2 voices, and was last updated 5 months, 2 weeks ago by
Elvin.
-
AuthorPosts
-
September 15, 2020 at 7:33 pm #1445028
Pedro
Hola! Estoy instalando un plugin que colocará un icono de carrito (por medio de shortcode)
Me gustaría reemplazar el icono de carrito que coloca GP Premium por este shortcode.
Quisiera saber cómo puedo hacer para insertar ese shortcode en el mismo lugar donde actualmente está el icono de carrito de GPP.
¡Gracias!
September 15, 2020 at 8:54 pm #1445080Elvin
StaffCustomer SupportYou can try this PHP code.
add_filter( 'generate_woocommerce_menu_cart_icon', 'tu_change_wc_menu_cart_icon' ); function tu_change_wc_menu_cart_icon() { return sprintf( do_shortcode( '[your-shortcode]' ) ); }
Just make sure the output of your shortcode is similar to something like this
<i class="fa fa-shopping-cart" aria-hidden="true"></i>
.
https://docs.generatepress.com/article/generate_woocommerce_menu_cart_icon/Let us know if it works for you.
A wise man once said:
"Have you cleared your cache?"September 17, 2020 at 12:04 pm #1447639Pedro
Hola Elvin! Gracias por responder.
He agregado el código como me indicaste, y lo único que hace es añadir ese mismo código al principio del sitio.
Aquí la captura de pantalla de cómo lo configure: https://mega.nz/file/CpNUXAaY#6WDabaIeWDsqKgpS0rXG6WfmiaKUcUndOLhVVIAwf0s
Aquí una foto del resultado: https://mega.nz/file/74NCUYiJ#mfWPz0Mrr7W10cociDDLip3euenrBU2BXFUv3xCBNb4
Lo que deseo es reemplazar el icono de carrito que GP Premium coloca por el shortcode de este plugin: https://docs.xootix.com/side-cart-for-woocommerce/#shortcodes
September 17, 2020 at 12:49 pm #1447702Elvin
StaffCustomer SupportCan you try adding the PHP code by doing any of the methods added here?
https://docs.generatepress.com/article/adding-php/
We recommend using Code Snippets plugin as it’s the easiest one to use.
A wise man once said:
"Have you cleared your cache?"September 17, 2020 at 3:17 pm #1447827Pedro
Hola Elvin! Gracias por tu respuesta.
Lo he añadido al functions.php de mi child theme.
Ahora se muestra el shortcode, pero también se muestra el icono de carrito de GPP.
Aquí puedes ver una captura de pantalla: https://mega.nz/file/HtFTiCxZ#WLEZw7ri_RYVBEA9aihxtqvNXmqgnnlr-3A4Zg7iEGs
September 17, 2020 at 3:54 pm #1447849Elvin
StaffCustomer SupportAfter adding the PHP for your shortcode, you can remove the unwanted icon attached as on the :before pseudo element by adding this CSS code.
.main-navigation a.cart-contents:not(.has-svg-icon).shopping-bag:before { display:none; }
This should remove the gpp cart icon.
Let us know how it goes.
A wise man once said:
"Have you cleared your cache?"September 17, 2020 at 4:10 pm #1447860Pedro
Hola Elvin,
He agregado el código CSS pero no desapareció el icono de carrito de GPP.
September 17, 2020 at 4:18 pm #1447862Elvin
StaffCustomer SupportCan you provide the site URL link so we could take a closer look?
Also, can you leave the shortcode running so we can see how this renders.
A wise man once said:
"Have you cleared your cache?"September 17, 2020 at 4:29 pm #1447867Pedro
Hola Elvin,
Es un entorno de pruebas creado con WP Staging, pero no está disponible al público a menos que se inicie sesión como administrador.
Por otro lado, modifiqué un poco el CSS que me diste, quedó así:
.shopping-cart { display: none; } .number-of-items { display: none!important; }
Con este nuevo CSS, si se ocultó el icono de GPP.
¿Podrías decirme si está correcto o hay que corregir algo?
September 17, 2020 at 4:51 pm #1447875Elvin
StaffCustomer SupportThat could work.
That’s pretty much the same as this:
.cart-contents>span.gp-icon.shopping-cart { display: none; } .cart-contents>span.number-of-items { display: none; }
And I believe we don’t have to worry about .number-of-items too now as your shortcode seems to render its own JS that counts cart contents.
That should be good to go. Give it a try and let us know if it works.
A wise man once said:
"Have you cleared your cache?"September 17, 2020 at 5:01 pm #1447879Pedro
Hola Elvin,
Este último código CSS que acabas de darme funcionó perfectamente.
¡Muchísimas gracias!
September 17, 2020 at 7:27 pm #1447978Elvin
StaffCustomer SupportNice one.
No problem. Always glad to be of any help.:)
A wise man once said:
"Have you cleared your cache?" -
AuthorPosts
- You must be logged in to reply to this topic.