cancel
Showing results for 
Search instead for 
Did you mean: 

how to insert different href for continue shopping button in two differnt strore views ?

SOLVED

how to insert different href for continue shopping button in two differnt strore views ?

Hi guys , i have two different storeviews with two different continue shopping buttons in checkout page .But i want to redirect them with two different url. When am trying to change that button href its also showing impact on second store view in magento 2.HOW CAN I OVERCOME THIS ISSUE ?can any one guide me ?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: how to insert different href for continue shopping button in two differnt strore views ?

You need to check first storeName value getting or not, you have directly used storeManager object in your code,

You need to create the function for store object and call the function inside template file for getting store name.

 

Kindly check below blog for getting store information,

Get store information in Magento 2

 

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

View solution in original post

3 REPLIES 3

Re: how to insert different href for continue shopping button in two differnt strore views ?

You need to apply custom condition  based on store view, First, you need to override specific file which contains Continue button link,

Now In that file, you need to get current store value using dependency \Magento\Store\Model\StoreManagerInterface and based on store value you need to give a custom href link.

$storeName = $this->_storeManager->getStore()->getName();

if(first_store) {   <a href="">Continue button</a> } else {   <a href="">Continue button</a> }

 

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: how to insert different href for continue shopping button in two differnt strore views ?

the below is the code : its not working ?

 

<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

?>
<?php /** @var $block \Magento\Checkout\Block\Onepage\Success */
$storeName = $this->_storeManager->getStore()->getName();


?>
<div class="checkout-success">
<?php if ($block->getOrderId()):?>
<?php if ($block->getCanViewOrder()) :?>
<p><?= __('Your order number is: %1.', sprintf('<a href="%s" class="order-number"><strong>%s</strong></a>', $block->escapeHtml($block->getViewOrderUrl()), $block->escapeHtml($block->getOrderId()))) ?></p>
<?php else :?>
<p><?= __('Your order # is: <span>%1</span>.', $block->escapeHtml($block->getOrderId())) ?></p>
<?php endif;?>
<p><?= /* @escapeNotVerified */ __('We\'ll email you an order confirmation with details and tracking info.') ?></p>
<?php endif;?>

<?= $block->getAdditionalInfoHtml() ?>

<div class="actions-toolbar">
<div class="primary">

<?php if($storeName): ?>
<a class="action primary continue" href="https://www.google.co.in/"><span><?= /* @escapeNotVerified */ __('Continue Shopping') ?></span></a>
<?php endif;?>
</div>
</div>
</div>

Re: how to insert different href for continue shopping button in two differnt strore views ?

You need to check first storeName value getting or not, you have directly used storeManager object in your code,

You need to create the function for store object and call the function inside template file for getting store name.

 

Kindly check below blog for getting store information,

Get store information in Magento 2

 

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial