This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
React + Vite projects | |
npm install jest babel-jest @babel/preset-env @babel/preset-react --save-dev | |
npm install @testing-library/react @types/jest jest-environment-jsdom --save-dev | |
-------------- | |
Whwen using fetch | |
npm install whatwg-fetch --save-dev | |
------------. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function claserama_cart_only_has_virtual_product() | |
{ | |
//Primero declaramos algunas variables que ocuparemos | |
$has_only_virtual=false; //Esta será la variable final que retornaremos y que nos dice si solo hay artículos virtuales en el pedido | |
$virtual_products = 0; //Primero iniciamos el contador de productos virtuales a 0 | |
$total_products = 0; // Iniciamos el contador de todos los productos a cero | |
// Vamos a checar cada uno de los elementos que se encuentran en el carrito, uno por uno por medio de la función WC()->cart->get_cart() que nos regresa un objeto con cada uno de los elementos | |
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Función para cambiar de lugar los campos del checkout de Woocommerce | |
*/ | |
function claserama_rearrange_checkout_fields($fields){ | |
//para mover el orden de los elementos del array, debemos asignar una propiedad de prioridad a cada campo, en nuestro ejemplo le dimos una prioridad menor al email, entonces colocará este campo al principio de nuestra forma | |
$fields['billing']['billing_email']['priority'] = 10; | |
$fields['billing']['billing_first_name']['priority'] = 20; | |
$fields['billing']['billing_last_name']['priority'] = 30; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
breakpoint(intern) is a mixin to show this block only on screen sizez bigger than 768px | |
*/ | |
.alignfull { | |
@include breakpoint(intern){ | |
margin-left: calc(50% - 50vw); | |
margin-right: calc(50% - 50vw); | |
width: auto; | |
max-width: 1000%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Add support for wide alignment odf images in Gutenberg */ | |
add_theme_support( 'align-wide' ); | |
/* Add 2 colors palette for the editor in Gutenberg */ | |
add_theme_support('editor-color-palette', | |
array( | |
array( | |
'name' => 'primary color', | |
'color' => '#02b3e4' | |
), |