Devera Widget Integration in WooCommerce
- Include this code in the functions.php file or using the Code Snippets plugin:
function devera_shortcode() { $client = "<your-client-id>"; $token = "<your-token>"; $language = ""; /* If you leave it empty it will take the language of the system where it is executed, but you can put es for Spanish, en for English or de is for German */ if ( ! is_product() ) { return ''; } global $product; if ( ! $product ) { return ''; } $output = '<devera-widget product-id="'.esc_attr($product->get_id()).'" client-id="'.esc_attr($client).'" token="'.esc_attr($token).'" language="'.esc_attr($language).'" ></devera-widget>'; $output .= '<script src="https://recycling.nastaeco.com/recycling.umd.js"></script>'; return $output; } add_shortcode( 'devera', 'devera_shortcode' );
If you do it with Code Snippets:
- Go to the plugins section and install Code Snippets.
- Add a new code snippet
- Enter the code here, save and activate everywhere
- Access to Appearance -> Editor and here Templates -> Woocommerce -> Single Product
- Here we add a block
- Select custom HTML
- Enter
[devera]
in the HTML block, place it as you need and save.
- If you want to change the styles add to your wordpress these css styles and customize them as you want:
/* Colors */ --devera-main: #4b858e; /* These are the default hexadecimal heats */ --devera-mainActive: #2c4e54; --devera-mainDisabled: #9db8bc; --devera-secondary: #a3d5cd; --devera-secondaryDark: #9ac6bf; --devera-secondaryMiddle: #c8e7e2; --devera-secondaryLight: #e8f6f3; --devera-secondarySuperDark: #7baaa3; /* Font */ --devera-font: 'Montserrat', sans-serif; /* Sizing */ --devera-microMaxWidth: 420px; --devera-microHeight: 500px;