Skip to content

Instantly share code, notes, and snippets.

@veritstudio
veritstudio / circle.css
Last active November 25, 2019 19:47
Build shapes with CSS only
.circle {
width: 200px;
height: 200px;
background: #00a1de;
border-radius: 50%
}
@veritstudio
veritstudio / default.xml
Created November 21, 2019 21:18
Add class to body - Magento 2
<attribute name="class" value="my-new-class"/>
@veritstudio
veritstudio / custom.phtml
Created November 21, 2019 20:53
Call store switcher - Magento 2
<?= $this->getLayout()
->createBlock('Magento\Store\Block\Switcher')
->setTemplate('Magento_Store::switch/stores.phtml')
->toHtml(); ?>
@veritstudio
veritstudio / CustomBlock.php
Last active November 19, 2019 20:04
Get customer details - Magento 2
<?php
namespace VeritStudio\CustomModule\Block;
use Magento\Customer\Model\Session;
class CustomBlock extends \Magento\Framework\View\Element\Template {
public function __construct(
Session $customerSession,
_RenderControls: function () {
var $widget = this,
container = this.element,
classes = this.options.classes,
chooseText = this.options.jsonConfig.chooseText;
$widget.optionsMap = {};
$.each(this.options.jsonConfig.attributes, function () {
var item = this,
@veritstudio
veritstudio / sidebar.js
Created September 10, 2019 20:01
add fade out effect when removing item from minicart - Magento 2
/**
* @param {HTMLElement} elem
* @private
*/
_removeItem: function (elem) {
var itemId = elem.data('cart-item');
this._ajax(this.options.url.remove, {
'item_id': itemId
}, elem, this._removeItemAfter);
@veritstudio
veritstudio / agreements.less
Last active August 31, 2019 08:36
Move checkout agreements below place order button
.payment-method-content {
.lib-vendor-prefix-display();
.lib-vendor-prefix-flex-direction(column);
}
.checkout-agreements-block {
order: 1;
}
@veritstudio
veritstudio / cms.xml
Created August 27, 2019 19:58
Add class to body CMS Page - Magento 2
<body>
<attribute name="class" value="custom_class"/>
</body>
@veritstudio
veritstudio / link.html
Created August 24, 2019 20:35
Get checkout link in html template - Magento 2
@veritstudio
veritstudio / link.html
Created August 24, 2019 19:58
Get cart url in html template - Magento 2