File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 3232 {{ product.regularPrice }}
3333 </div >
3434 <div class =" ml-4 text-xl text-gray-900" >
35- {{ product.salePrice }}
35+ {{ filteredVariantPrice( product.salePrice) }}
3636 </div >
3737 </div >
3838 <div v-else >
4848</template >
4949
5050<script >
51+ import { filteredVariantPrice } from ' @/utils/functions'
52+
5153export default {
5254 name: ' ShowAllProducts' ,
5355 props: {
5456 products: { type: Array , required: true },
5557 },
58+
5659 methods: {
5760 productImage (product ) {
5861 return product .image
5962 ? product .image .sourceUrl
6063 : process .env .placeholderSmallImage
6164 },
65+ filteredVariantPrice,
6266 },
6367}
6468 </script >
Original file line number Diff line number Diff line change 2424 <p class =" text-3xl font-bold text-left" >{{ product.name }}</p >
2525 <div v-if =" product.onSale" class =" flex" >
2626 <p class =" pt-1 mt-4 text-3xl text-gray-900" >
27- {{ product.salePrice }}
27+ {{ filteredVariantPrice( product.salePrice) }}
2828 </p >
2929 <p class =" pt-1 pl-8 mt-4 text-2xl text-gray-900 line-through" >
3030 {{ product.regularPrice }}
6565</template >
6666
6767<script >
68- import { stripHTML } from ' @/utils/functions'
68+ import { stripHTML , filteredVariantPrice } from ' @/utils/functions'
6969
7070export default {
7171 name: ' ShowSingleProduct' ,
7272 props: {
7373 product: { type: Object , required: true },
7474 },
75- methods: { stripHTML },
75+ methods: { stripHTML, filteredVariantPrice },
7676}
7777 </script >
Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ function stripHTML(description) {
44 return description . replace ( / ( < ( [ ^ > ] + ) > ) / gi, '' )
55}
66
7+ function filteredVariantPrice ( price ) {
8+ // Filter price from "kr198.00 - kr299.00" to kr299.00
9+ return price . substring ( price . length , price . indexOf ( '-' ) ) . replace ( '-' , '' )
10+ }
11+
712function createCheckoutData ( form ) {
813 const checkoutData = {
914 clientMutationId : uid ( ) ,
@@ -42,4 +47,4 @@ function createCheckoutData(form) {
4247 return { checkoutData }
4348}
4449
45- export { stripHTML , createCheckoutData }
50+ export { stripHTML , createCheckoutData , filteredVariantPrice }
You can’t perform that action at this time.
0 commit comments